{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# Model"
   ]
  },
  {
   "cell_type": "raw",
   "metadata": {
    "raw_mimetype": "text/restructuredtext"
   },
   "source": [
    ".. toctree::                                               \n",
    "   :maxdepth: 2                                       \n",
    "   :caption: Contents: \n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {},
   "outputs": [],
   "source": [
    "import torch_struct\n",
    "import torch\n",
    "import matplotlib.pyplot as plt\n",
    "import matplotlib"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {},
   "outputs": [],
   "source": [
    "matplotlib.rcParams['figure.figsize'] = (7.0, 7.0)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Chain"
   ]
  },
  {
   "cell_type": "raw",
   "metadata": {
    "raw_mimetype": "text/restructuredtext"
   },
   "source": [
    ".. autoclass:: torch_struct.LinearChainCRF "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAbQAAACSCAYAAAAttj/ZAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADh0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uMy4xLjEsIGh0dHA6Ly9tYXRwbG90bGliLm9yZy8QZhcZAAAKx0lEQVR4nO3df6xfd13H8eeLe7vphmNjXeTSVjdiJRIl27gpkpllcUw6JKuJmGyJOojkJoYpaoxumozIX9M//BUJZOkqnSLDDNELaawjG0FjwN1hB2yj49qQ9HbTjnYMKsrsePvHPV3uLt+2Y99zv6f30+cj+eae8z2fnff75PttXzvnfO5pqgpJkta7lw3dgCRJfTDQJElNMNAkSU0w0CRJTTDQJElNMNAkSU0YK9CSvDLJfUm+0v286CTjnkuyr3vNj1NTkqRRMs7voSX5I+BoVd2R5Fbgoqr63RHjjlXVy8foU5KkUxo30PYD11TVk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zcT92XA31ZVc1PbG/aDwMe7x9hOA39TVf84bEu9+zXgw93JwAHgnUM2c9ZP25cktcFLjpKkJhhokqQmGGiSpCYYaJKkJhhokqQmGGiSpCYYaJKkJvw/YzEJz1RVULwAAAAASUVORK5CYII=\n",
      "text/plain": [
       "<Figure size 504x504 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    }
   ],
   "source": [
    "batch, N, C = 3, 7, 2\n",
    "def show_chain(chain):\n",
    "    plt.imshow(chain.detach().sum(-1).transpose(0, 1))\n",
    "\n",
    "# batch, N, z_n, z_n_1\n",
    "log_potentials = torch.rand(batch, N, C, C)\n",
    "dist = torch_struct.LinearChainCRF(log_potentials)\n",
    "show_chain(dist.argmax[0])"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAbQAAACSCAYAAAAttj/ZAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADh0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uMy4xLjEsIGh0dHA6Ly9tYXRwbG90bGliLm9yZy8QZhcZAAAK/ElEQVR4nO3df6xfd13H8edrbVfXwVix0zVrZSM0C6iEjZtOM7M0jmmHZDURzJaog0iaGIooMdJhskX+msb4K5CRpqt0ghtmCF6xOkc2AsYMe4fF/aKjNpDeMi2sY6ybMjre/nFPl7vrt+3sPd97ej99PpJv7vmc8+n5vE+a9tVzzuf7aaoKSZIWu7OGLkCSpD4YaJKkJhhokqQmGGiSpCYYaJKkJhhokqQmzCvQkrw6yb1Jvtb9XHmcfi8k2dN9JuczpiRJo2Q+30NL8ofA4aq6NclWYGVVfWBEvyNV9Yp51ClJ0gnNN9D2Ahuq6okkq4HPV9WlI/oZaJKksZpvoH2nqs7vtgM8daw9p99RYA9wFLi1qj5znPNtBjYDnLXk7DevWHHBKdd2unvhnAxdwl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ZuKeBfx1VTU3tb1hPwp8ulvGdinwV1X1j8OW1Lv3Ap/obgb2A+8aspgzftq+JKkNPnKUJDXBQJMkNcFAkyQ1wUCTJDXBQJMkNcFAkyQ1wUCTJDXhfwH1nBXQezGpvgAAAABJRU5ErkJggg==\n",
      "text/plain": [
       "<Figure size 504x504 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    }
   ],
   "source": [
    "show_chain(dist.marginals[0])"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "metadata": {
    "scrolled": true
   },
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAbQAAACSCAYAAAAttj/ZAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADh0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uMy4xLjEsIGh0dHA6Ly9tYXRwbG90bGliLm9yZy8QZhcZAAAKuElEQVR4nO3df6xfd13H8eeL22664dhYF7m01Y1YiUTJNm6KZGZZHJMOyWoiJluiDiK5iWGKGqObJiPy1/QPf0UCWbpKp8gwQ/RCGuvIRtAYcHfYAdvouDYkvd20ox2DijI73v5xT5e7y7ft2Pfc77n30+cj+eae8z2fnvf75PZ7Xz3nfO5pqgpJkta7lw3dgCRJfTDQJElNMNAkSU0w0CRJTTDQJElNMNAkSU0YK9CSvDLJfUm+0n296BTjnkuyv3vNjVNTkqRRMs7voSX5I+BYVd2R5Fbgoqr63RHjjlfVy8foU5Kk0xo30A4A11TVk0mmgU9X1WtHjDPQJEmratxA+3pVXdgtB3j65PqKcSeA/cAJ4I6q+vtT7G8WmAWYYuoN53HBS+5trfvR139r6BZW1eNfOG/oFqSR/Oytb9/k6a9V1SWjtp0x0JJ8CnjViE2/D+xZHmBJnq6q77qPlmRzVR1O8hrgfuDaqvqP09W9IK+sN+ba0/a2nu17Yv/QLayqt7z68qFbkEbys7e+farufaiqZkZt23CmP1xVbz7Vt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kq1JHkjyaJJHkrxn6J76kuT7kvxbkoe7Y/uDoXtaDUmmkvx7kk8O3Uvfknw1yRe7R/7ND91P35JcmOTeJF9O8liSNw3az9l+Dy3JFPA4cB2wCDwI3FRVjw7aWE+SXA0cB+4e9TuC612SaWC6qj6f5AeAh4Cfa+H7180MPr/7/c2NwL8A76mqzw7cWq+S/BYwA1zQ2uPxknwVmKmqJn8pPskelh5ruCvJOcB5VfX1ofrxDA22AwtVdbCqngXuAXYO3FNvWn8sWVU9WVWf75a/CTwGbB62q37UkuPd6sbu1dS/QJNsAX4W2DV0L/reJHkFcDVwF0BVPTtkmIGBBks//A4tW1+kkR+IZ5vuaTVXAJ8btpP+dJfj9gNHgPuqqplj6/wp8DvAd4ZuZJUU8E9JHuoe7deSy4CngL/sLhnvSnL+kA0ZaGpCkpcDHwN+o6q+MXQ/famq56rqcmALsD1JM5eNk7wNOFJVDw3dyyr6qaq6ErgeeHd3C6AVG4ArgQ9U1RXAfwODzkEw0OAwsHXZ+pbuPa0T3f2ljwEfrqq/G7qf1dBdynkA2DF0Lz26Crihu890D/DTSf562Jb6VVWHu69HgI+zdIujFYvA4rKrBveyFHCDMdCWJoFsS3JZd1PzRmBu4J70InUTJ+4CHquqPx66nz4luSTJhd3y97M0cenLw3bVn6q6raq2VNWlLH3u7q+qXxy4rd4kOb+bqER3Ke5ngGZmG1fVfwKHkry2e+taYNDJWJP872PWpKo6keQWYB8wBewe9V/brFejHktWVXcN21WvrgJ+Cfhid68J4Pe6h2Cvd9PAnm4m7suAv62q5qa2N+wHgY93j7HdAPxNVf3jsC317teAD3cnAweBdw7ZzFk/bV+S1AYvOUqSmmCgSZKaYKBJkppgoEmSmmCgSZKaYKBJkppgoEmSmvD/my0Jz0FU+nEAAAAASUVORK5CYII=\n",
      "text/plain": [
       "<Figure size 504x504 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    }
   ],
   "source": [
    "event = dist.to_event(torch.tensor([[0, 1, 0, 1, 1, 1, 0, 1]]), 2)\n",
    "show_chain(event[0])"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Hidden Markov Model"
   ]
  },
  {
   "cell_type": "raw",
   "metadata": {
    "raw_mimetype": "text/restructuredtext"
   },
   "source": [
    ".. autoclass:: torch_struct.HMM"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAbQAAAClCAYAAAA0yQjMAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADh0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uMy4xLjEsIGh0dHA6Ly9tYXRwbG90bGliLm9yZy8QZhcZAAAKkUlEQVR4nO3df4xdZZ3H8ffHacEVRREarG0jmC1k3V3C6qRqMIasooU11ERMINHFjaaJkay7/uFCTDD6F/qH+yOaNQQJsmtEA5odsbtdDBg1u2gHt6AFi7PEpFPZFFsXJahY/PrHnCHD9LY1vcd7ps+8X8nNnB/PnOfbJ3PnM+ec556mqpAk6WT3nKELkCSpDwaaJKkJBpokqQkGmiSpCQaaJKkJBpokqQljBVqSFye5K8kPu69nHKXd00l2d6+ZcfqUJGmUjPM5tCQfBw5V1Q1JrgXOqKq/G9Huiap6/hh1SpJ0TOMG2l7g4qp6NMl64OtVdf6IdgaaJOn3atx7aGdX1aPd8v8BZx+l3XOTzCa5N8lbx+xTkqQjrDlegyRfA14yYteHlq5UVSU52uney6pqf5KXA3cn+V5V/e+IvrYD2wGmmHrV8zj9uP+Alp13wZNDlzC4hx943tAlaAXwvbDA9wP8nJ/+pKrWjdo3kUuOy77nFuDOqrr9WO1Oz4vr1XnDCdfWgp0/3j10CYN780svHLoErQC+Fxb4foCv1e33VdX0qH3jXnKcAa7ulq8G/m15gyRnJDm1Wz4LuAh4cMx+JUl6lnED7QbgkiQ/BN7YrZNkOslNXZs/AmaT3A/c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J4kDybZk+T9Q9c0aUmem+Q73WdI9yT5yNA1DSXJVJL/SXLn0LUMIcmPknyve3zh7ND1jOIlx2WSTAEPA5cA88Au4KqqenDQwiYsyeuBJ4Bbf5ePYrQoyXpgfVV9N8kLgPuAt66mn4VudvJp3WdI1wLfAt5fVfcOXNrEJfkAMA2cvhof43cyfNzKM7QjbQHmquqRqnoKuA3YNnBNE+fjzKCqHq2q73bLPwceAjYMW9Vk1YInutW13WvV/RWcZCPwF8BNQ9eiozPQjrQB2LdkfZ5V9ktMR+oeHPBnwLeHrWTyukttu4EDwF1VterGAPgH4IPAb4YuZEAF/GeS+7qnOq04Bpp0HEmeD9wB/E1V/Wzoeiatqp6uqguBjcCWJKvqEnSStwAHquq+oWsZ2Ouq6pXApcD7utsSK4qBdqT9wKYl6xu7bVqFuvtGdwCfq6ovDV3PkKrq/4F7gK1D1zJhFwGXd/eQbgP+PMm/DlvS5FXV/u7rAeDLLNyeWVEMtCPtAjYnOTfJKcCVwMzANWkA3YSIzwAPVdUnhq5nCEnWJXlRt/wHLEyW+sGwVU1WVV1XVRur6hwWfh/cXVXvGLisiUpyWjcxiiSnAW8CVtwMaANtmao6DFwD7GRhEsAXq2rPsFVNXvc4s/8Gzk8yn+TdQ9c0gIuAd7LwF/ni/7Z+2dBFTdh64J4kD7Dwx95dVbUqp62vcmcD30pyP/Ad4KtV9R8D13QEp+1LkprgGZokqQkGmiSpCQaaJKkJBpokqQkGmiSpCQaaJKkJBpokqQkGmiSpCb8FBKLMCVC1ciAAAAAASUVORK5CYII=\n",
      "text/plain": [
       "<Figure size 504x504 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    }
   ],
   "source": [
    "batch, V, N, C = 10, 3, 7, 2\n",
    "\n",
    "transition = torch.rand(C, C).log_softmax(0)\n",
    "emission = torch.rand(V, C).log_softmax(0)\n",
    "init = torch.rand(C).log_softmax(0)\n",
    "observations = torch.randint(0, V, size=(batch, N))\n",
    "\n",
    "dist = torch_struct.HMM(transition, emission, init, observations)\n",
    "show_chain(dist.argmax[0])"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Semi-Markov"
   ]
  },
  {
   "cell_type": "raw",
   "metadata": {
    "raw_mimetype": "text/restructuredtext"
   },
   "source": [
    ".. autoclass:: torch_struct.SemiMarkovCRF"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAaIAAABtCAYAAADjwmW6AAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADh0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uMy4xLjEsIGh0dHA6Ly9tYXRwbG90bGliLm9yZy8QZhcZAAAF9UlEQVR4nO3cz4ucBx3H8ffH3aaxEVRqL02CzaFWFlErS60WPBjBFMVeG9CDCL1YW0WQ6t8goocihBo9WNpD7KFIcAUVvEjo2hZsGgsharNpS1PFH1Rsmvr1MCNEaN3NZibfefZ5v047s8vDh2d/vHeeGSZVhSRJXd7WPUCSNG6GSJLUyhBJkloZIklSK0MkSWpliCRJrZbncdBdubZ2s2ceh5YkDdC/eJUL9Vre7HNzCdFu9vDRHJzHoSVJA3SifvGWn/PSnCSplSGSJLUyRJKkVoZIktTKEEmSWhkiSVIrQyRJamWIJEmtDJEkqZUhkiS1MkSSpFaGSJLUyhBJkloZIklSqy2FKMmhJM8lOZ3kgXmPkiSNx6YhSrIEPAjcCawAh5OszHuYJGkctvKI6DbgdFWdqaoLwKPAXfOdJUkai62EaC9w9pLbG9P7/keSe5KsJ1l/nddmtU+StMPN7MUKVXWkqlaravUarp3VYSVJO9xWQnQO2H/J7X3T+yRJumJbCdETwM1JDiTZBdwNPD7fWZKksVje7Auq6mKSe4E1YAk4WlUn575MkjQKm4YIoKqOA8fnvEWSNEK+s4IkqZUhkiS1MkSSpFaGSJLUyhBJkloZIklSK0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3DMQdwOeS/JHJZeBPJvlx76RB2AA2quq/j7qPMQmT/r9PAX+oqvNV9TrwGPDx5k1tFjlETwA3JzmQZBeTJ/Ieb9608JKEyfX6U1X1ne49Q1FV36yqfVV1E5OftV9W1Wj/Q92qqnoJOJvkluldB4FnGycNxfPA7Umum/7OHmTEL/JY7h7wVqrqYpJ7gTUmryg5WlUnm2cNwR3AF4DfJXl6et+3qup44ybtbF8BHp7+w3gG+GLznoVXVSeSHAOeZPJK16cY8Tss+M4KkqRWi3xpTpI0AoZIktTKEEmSWhkiSVIrQyRJamWIJEmtDJEkqZUhkiS1+g9PS0blIbEX5QAAAABJRU5ErkJggg==\n",
      "text/plain": [
       "<Figure size 504x504 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    }
   ],
   "source": [
    "batch, N, C, K = 3, 10, 2, 6\n",
    "def show_sm(chain):\n",
    "    plt.imshow(chain.detach().sum(1).sum(-1).transpose(0, 1))\n",
    "\n",
    "# batch, N, K, z_n, z_n_1\n",
    "log_potentials = torch.rand(batch, N, K, C, C)\n",
    "log_potentials[:, :, :3] = -1e9\n",
    "dist = torch_struct.SemiMarkovCRF(log_potentials)\n",
    "show_sm(dist.argmax[0])"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAaIAAABtCAYAAADjwmW6AAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADh0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uMy4xLjEsIGh0dHA6Ly9tYXRwbG90bGliLm9yZy8QZhcZAAAGdklEQVR4nO3dz4+cBR3H8c/H2VZtqwgCB9rV7oFAVhKErARL4kFMKNHIyYRGORgTLqJITAh64g8wBA7EpMHKQQKHyoGYxpqoiQdNZQWjtBWzKUi3FGn9BTTWbeHjYcakJkxnOp3h+zz7vF+n7uzm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UIQIAlHKS6R/UPiHpL1M63OWSTk7pWF3CeZsM520ynLfJdeXcfTzJFe/2iZmEaJpsLydZqt7RNpy3yXDeJsN5mxznjktzAIBihAgAUKoNIdpdPaClOG+T4bxNhvM2uc6fu8Y/RwQAWN/a8IgIALCONTpEtnfaftH2iu0Hqve0ge1527+0fcj2Qdv3Vm9qE9s928/b/kn1lraw/RHbe23/yfZh25+u3tQGtu8b/Iy+YPtJ2x+o3lSlsSGy3ZP0qKTbJS1K2mV7sXZVK5yV9O0ki5JulvR1ztsFuVfS4eoRLfOIpJ8muVbS9eL8jWR7q6RvSlpKcp2knqQ7a1fVaWyIJN0kaSXJkSRrkp6SdEfxpsZLcjzJc4M/v6n+ncLW2lXtYHubpM9Leqx6S1vYvkTSZyT9QJKSrCX5Z+2q1piT9EHbc5I2SXq1eE+ZJodoq6Sj53y8Ku5QL4jt7ZJukHSgdklrPCzpfknvVA9pkQVJJyT9cHBJ8zHbm6tHNV2SY5K+J+kVSccl/SvJz2pX1WlyiHARbG+R9GNJ30ryRvWeprP9BUmvJ/ld9ZaWmZN0o6TvJ7lB0ilJPJ87gu1L1b/CsyDpKkmbbX+ldlWdJofomKT5cz7eNrgNI9jeoH6EnkjydPWelrhF0hdtv6z+ZeDP2v5R7aRWWJW0muR/j7r3qh8mnN/nJL2U5ESSM5KelrSjeFOZJofoWUlX216wvVH9J/KeKd7UeLat/vX6w0keqt7TFkm+k2Rbku3qf6/9Ikln/4U6riSvSTpq+5rBTbdKOlQ4qS1ekXSz7U2Dn9lb1eEXecxVDxgmyVnb90jar/4rSvYkOVg8qw1ukXSXpD/a/v3gtu8m2Ve4CevbNyQ9MfgH4xFJXy3e03hJDtjeK+k59V/p+rw6/A4LvLMCAKBUky/NAQA6gBABAEoRIgBAKUIEAChFiAAApQgRAKAUIQIAlCJEAIBS/wWSpl/lE38HAgAAAABJRU5ErkJggg==\n",
      "text/plain": [
       "<Figure size 504x504 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    }
   ],
   "source": [
    "show_sm(dist.marginals[0])"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 9,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAaIAAABtCAYAAADjwmW6AAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADh0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uMy4xLjEsIGh0dHA6Ly9tYXRwbG90bGliLm9yZy8QZhcZAAAGF0lEQVR4nO3cz4ucBx3H8ffH3aYxEbRoL/mBzaFWFrGtLLVa8GCEpij22oAeROjF1iqCVP8GET0UIdTowdIeYg9FgitUwYvErm3QprESojabVppatFKxafTrYUdIIXE225l859l5v06ZmeXhw0Nm3zvPDJOqQpKkLu/oHiBJmm+GSJLUyhBJkloZIklSK0MkSWpliCRJrRancdBtuba2s3Mah1aTD3z4n90TLusPv93RPUHSGP/idc7XG7nUY1MJ0XZ28tHsn8ah1WRl5Xj3hMu6c9ct3RMkjXGsnrzsY16akyS1MkSSpFaGSJLUyhBJkloZIklSK0MkSWpliCRJrQyRJKmVIZIktTJEkqRWhkiS1MoQSZJaGSJJUitDJElqtaEQJTmQ5Pkkp5I8OO1RkqT5MTZESRaAh4C7gCXgYJKlaQ+TJM2Hjbwiug04VVWnq+o88Bhw93RnSZLmxUZCtBs4c9HttdF9b5Hk3iSrSVbf5I1J7ZMkbXET+7BCVR2qquWqWr6Gayd1WEnSFreREJ0F9l50e8/oPkmS3raNhOgp4MYk+5JsA+4BnpjuLEnSvFgc9wNVdSHJfcAKsAAcrqoTU18mSZoLY0MEUFVHgaNT3iJJmkN+s4IkqZUhkiS1MkSSpFaGSJLUyhBJkloZIklSK0MkSWpliCRJrQyRJKmVIZIktTJEkqRWhkiS1MoQSZJapaomftDlm7fXr1f2jv9BvcWdu27pnqA5s/Li8e4Jg+Rz9codqyd5rV7NpR7zFZEkqZUhki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r9yar6dveeoaiqb1TVnqq6gfX/az+vqrn9C3WjquovwJkkN43u2g881zhpKF4Abk+yY/Sc3c8cf8hjsXvA5VTVhST3ASusf6LkcFWdaJ41BHcAnwd+l+T46L5vVtXRxk3a2u4HHhn9wXga+ELznplXVceSHAGeZv2Trs8wx9+w4DcrSJJazfKlOUnSHDBEkqRWhkiS1MoQSZJaGSJJUitDJElqZYgkSa0MkSSp1X8BA3VRlcLq6DEAAAAASUVORK5CYII=\n",
      "text/plain": [
       "<Figure size 504x504 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    }
   ],
   "source": [
    "# Use -1 for segments.\n",
    "event = dist.to_event(torch.tensor([[0, 1, -1, 1, -1, -1, 0, 1,  1, -1, -1]]), (2, 6))\n",
    "show_sm(event[0])"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Alignment"
   ]
  },
  {
   "cell_type": "raw",
   "metadata": {
    "raw_mimetype": "text/restructuredtext"
   },
   "source": [
    ".. autoclass:: torch_struct.AlignmentCRF"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 10,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAagAAAFECAYAAAByNKo5AAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADh0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uMy4xLjEsIGh0dHA6Ly9tYXRwbG90bGliLm9yZy8QZhcZAAARI0lEQVR4nO3df4wtZ3kf8O9TXyiFUDB1S4iNgomQJRq1xb1CJE0pqik1FMVpFVWOmtQEpKuopYUqEXKLFEX9p03Tpj+jRC5xoRVyUAk0FoKCSyOhSuDmXscGGxPsUAJ2jQ11BWnzB3Hz9I89ttbr3XvXe+buedbn85GO9pyZ95x55s7s+d535t2Z6u4AwDR/aNMFAMB+BBQAIwkoAEYSUACMJKAAGElAATDSqeNcWF1WnZ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5L4k/yXJi1ZtTyd5z673vnX1e3F/kh8ftg73Z+fczOO/E4+PxP2uJB893343aB3+w2pf/2x2Qucle9dh9fop32ET6l9Nf+/j+/+utiO3wfkeriQBwEgGSQAwkoACYCQBBcBIAgqAkQQUACMJKABGElAAjCSgABjp/wNJasDKI4RnJAAAAABJRU5ErkJggg==\n",
      "text/plain": [
       "<Figure size 504x504 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    }
   ],
   "source": [
    "batch, N, M = 3, 15, 20\n",
    "def show_deps(tree):\n",
    "    plt.imshow(tree.detach())\n",
    "\n",
    "log_potentials = torch.rand(batch, N, M, 3)\n",
    "dist = torch_struct.AlignmentCRF(log_potentials)\n",
    "show_deps(dist.argmax[0])"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 11,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAagAAAFECAYAAAByNKo5AAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADh0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uMy4xLjEsIGh0dHA6Ly9tYXRwbG90bGliLm9yZy8QZhcZAAAUhUlEQVR4nO3dfYxldX3H8fd3Z/aBZXlYBBGBCBhCtKYtZGJ8qjVi6UqNaxvbQGqLSrMxra00NgRroqZ/1draR2OzVQptCZKiVmKwQn0obSLUBXkGBRFxcdldHnYXWNh5+vaPe3czDndmZ+d+d+5vuO9XMpl7zz3zvd8z58z9zDn33POLzESSpNasGHQDkiT1YkBJkppkQEmSmmRASZKaZEBJkppkQEmSmjS6lE8Wx0dyWl2942+tq7WnrhQAE4W1/CCApBe5xzPzhNkTlzSgOA3YUlduY9TV+lZdKQC2FdaqDDuA6cJa1eFpGEtD6ce9JnqIT5LUJANKktQkA0qS1CQDSpLUpL4CKiI2RMT3I+LBiLisqilJkhYdUBExAnwGeDvwauDCiHh1VWOSpOHWzx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P9BvAA8F/Acd15x4DPzfjZ93f/Lh4E3tfYMjxI572Z/X8T+8/EfTlw/XzbXUPL8K/dbf1OOqFz0uxl6N5/wWtYC/13p1+xf/ufMW+T62C+L68kIUlqkidJSJKaZEBJkppkQEmSmmRASZKaZEBJkppkQEmSmmRASZKaZEBJkpr0/w1Bym+TkvZkAAAAAElFTkSuQmCC\n",
      "text/plain": [
       "<Figure size 504x504 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    }
   ],
   "source": [
    "show_deps(dist.marginals[0])"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Dependency Tree"
   ]
  },
  {
   "cell_type": "raw",
   "metadata": {
    "raw_mimetype": "text/restructuredtext"
   },
   "source": [
    ".. autoclass:: torch_struct.DependencyCRF"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 12,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAZgAAAGbCAYAAAD5r4b7AAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADh0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uMy4xLjEsIGh0dHA6Ly9tYXRwbG90bGliLm9yZy8QZhcZAAANOklEQVR4nO3dz4vnB33H8de7O5uNu7ZqaS+7G5ocrCVIm8gQowEPWSFaxVx6iKBQL3upGkWQ2Iv/gIgeRFiiXgzmsOYgElyLPw69LG6SpZqslhBtsknElFIjkWY3+O5hppCmifOdOu/9fr+zjwcEdr7f73548WEmz/18v9+Zqe4OAOy1P1r2AAD2J4EBYITAADBCYAAYITAAjNiYOOg1daivzZGJQwOwQv4rL+RSv1ivdt9IYK7Nkby9TkwcGoAVcra/95r3eYoMgBECA8AIgQFghMAAMEJgABghMACMEBgARggMACMEBoARAgPACIEBYITAADBCYAAYITAAjFgoMFX1nqr6WVU9XlX3TI8CYP3tGJiqOpDkS0nem+TGJB+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e5zBQPACIEBYITAADBCYAAYITAAjBAYAEYIDAAjBAaAEQIDwAiBAWCEwAAwQmAAGCEwAIwQGABGCAwAIwQGgBECA8AIgQFghMAAMEJgABghMACMEBgARggMACMEBoARAgPACIEBYITAADBCYAAYITAAjBAYAEYIDAAjBAaAEQIDwAiBAWCEwAAwQmAAGCEwAIwQGABGCAwAIwQGgBECA8AIgQFghMAAMEJgABghMACMEBgARggMACMEBoARAgPACIEBYITAADBCYAAYITAAjFgoMFX1yap6tKp+UlXfqKprp4cBsN52DExVHUvy8SSb3f3WJAeS3DU9DID1tuhTZBtJXldVG0kOJ3lmbhIA+8GOgenup5N8LsmTSZ5N8uvu/u4rH1dVJ6vqXFWdu5wX934pAGtlkafI3pTkziQ3JDma5EhVfeiVj+vuU9292d2bB3No75cCsFYWeYrs3Ul+3t3PdfflJA8keefsLADW3SKBeTLJrVV1uKoqyYkkF2ZnAbDuFnkN5myS00keTvLj7b9zangXAGtuY5EHdfdnk3x2eAsA+4jv5AdghMAAMEJgABghMACMEBgARggMACMEBoARAgPACIEBYITAADBCYAAYITAAjBAYAEYs9NOUASaceeb8sieslTuO3rTsCbviCgaAEQIDwAiBAWCEwAAwQmAAGCEwAIwQGABGCAwAIwQGgBECA8AIgQFghMAAMEJgABghMACMEBgARggMACMEBoARAgPACIEBYITAADBCYAAYITAAjBAYAEYIDAAjBAaAEQIDwAiBAWCEwAAwQmAAGCEwAIwQGABGCAwAIwQGgBECA8AIgQFghMAAMEJgABhR3b33B616Lsm/7dHh/izJv+/Rsa4GztfuOF+743ztztVwvv6iu//81e4YCcxeqqpz3b257B3rwvnaHedrd5yv3bnaz5enyAAYITAAjFiHwJxa9oA143ztjvO1O87X7lzV52vlX4MBYD2twxUMAGtIYAAYsbKBqar3VNXPqurxqrpn2XtWWVVdV1U/qKrHqurRqrp72ZvWQVUdqKpHqurby96y6qrqjVV1uqp+WlUXquody9606qrqk9tfjz+pqm9U1bXL3nSlrWRgqupAki8leW+SG5N8sKpuXO6qlfZSkk91941Jbk3yD87XQu5OcmHZI9bEF5N8p7v/KsnfxHn7varqWJKPJ9ns7rcmOZDkruWuuvJWMjBJbknyeHc/0d2Xktyf5M4lb1pZ3f1sdz+8/effZOuL/9hyV622qjqe5H1J7l32llVXVW9I8q4kX0mS7r7U3f+53FVrYSPJ66pqI8nhJM8sec8Vt6qBOZbkqZd9fDH+h7mQqro+yc1Jzi53ycr7QpJPJ/ndsoesgRuSPJfka9tPKd5bVUeWPWqVdffTST6X5Mkkzyb5dXd/d7mrrrxVDQz/D1X1+iTfTPKJ7n5+2XtWVVW9P8mvuvuhZW9ZExtJ3pbky919c5IXknhd9Peoqjdl61mXG5IcTXKkqj603FVX3qoG5ukk173s4+Pbt/EaqupgtuJyX3c/sOw9K+62JB+oql9k6+nX26vq68udtNIuJrnY3f9zVXw6W8Hhtb07yc+7+7nuvpzkgSTvXPKmK25VA/OjJG+uqhuq6ppsvTj2rSVvWllVVdl6fvxCd39+2XtWXXd/pruPd/f12frc+n53X3X/ulxUd/8yyVNV9Zbtm04keWyJk9bBk0lurarD21+fJ3IVvjFiY9kDXk13v1RVH01yJlvvvvhqdz+65Fmr7LYkH07y46o6v33bP3b3g0vcxP7ysST3bf+D74kkH1nynpXW3Wer6nSSh7P1Ls9HchX+2Bg/KgaAEav6FBkAa05gABghMACMEBgARggMACMEBoARAgPAiP8GLRUZmfQD6L8AAAAASUVORK5CYII=\n",
      "text/plain": [
       "<Figure size 504x504 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    }
   ],
   "source": [
    "batch, N, N = 3, 10, 10\n",
    "def show_deps(tree):\n",
    "    plt.imshow(tree.detach())\n",
    "\n",
    "log_potentials = torch.rand(batch, N, N)\n",
    "dist = torch_struct.DependencyCRF(log_potentials)\n",
    "show_deps(dist.argmax[0])"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 13,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAA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+v6ruTfJAzj/K8/N5BT5tjKeKAWDEpt5FBsCWExgARggMACMEBoARAgPACIEBYITAADDi/wLN+LuiYjOIOwAAAABJRU5ErkJggg==\n",
      "text/plain": [
       "<Figure size 504x504 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    }
   ],
   "source": [
    "show_deps(dist.marginals[0])"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 14,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAZgAAAGbCAYAAAD5r4b7AAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADh0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uMy4xLjEsIGh0dHA6Ly9tYXRwbG90bGliLm9yZy8QZhcZAAANn0lEQVR4nO3b34ulB33H8c+3u2tioiJtU0myofHCCiJ1U4b0IlJoim7UoL1U0CthbypEWhC99B8Qb3qzaGiL1iDEgFjrGjQiAU3cxDU1PwxBUkwU1h+IptL88tuLHdsYN50jzPc8c868XjDszJ6Hk8/DbvY9zznPVHcHAPbbHyw9AIDtJDAAjBAYAEYIDAAjBAaAEUcnnvRldUlfmssnnhoOrD/7818tPWFRjz5w2dITWMB/57/yTD9dF3tsJDCX5vL8Zf3NxFPDgXXmzLmlJyzq5FUnlp7AAu7pr7zkY14iA2CEwAAwQmAAGCEwAIwQGABGCAwAIwQGgBECA8AIgQFghMAAMEJgABghMACMEBgARggMACMEBoARAgPACIEBYITAADBCYAAYITAAjBAYAEYIDAAjBAaAEQIDwAiBAWCEwAAwQmAAGLFSYKrqpqr6XlU9VlUfnh4FwObbMzBVdSTJPyZ5W5I3JHlPVb1hehgAm22VK5jrkzzW3d/v7meS3JbkXbOzANh0qwTm6iQ/eMHXT+z+3m+pqlNVdbaqzj6bp/drHwAbat/e5O/u09290907x3LJfj0tABtqlcA8meSaF3x9fPf3AOAlrRKYbyV5XVW9tqp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k+RV3X3z0nvWqaoeT7LT3Qfyh0y36Qrm+iSPdff3u/uZJLcledfCm9amu7+e5GdL71hCd/+ou+/f/fyXSR5OcvWyq9ajL3hq98tjux/b8V3jCqrqeJJ3JPnE0lv4XdsUmKuT/OAFXz+RQ/KPDP+nqq5Ncl2Se5Zdsj67LxGdS3I+yZ3dfWjOPcnHk3woya+XHrKQTvLlqrqvqk4tPebFtikwHHJV9Yoktyf5YHf/Yuk969Ldz3f3iSTHk1xfVYfiJdKqujnJ+e6+b+ktC3pzd/9Fkrcl+bvdl8oPjG0KzJNJrnnB18d3f49DYPf9h9uTfLq7P7f0niV098+T3JXkpqW3rMkNSd65+z7EbUlurKpPLTtpvbr7yd1fzye5IxfeKjgwtikw30ryuqp6bVW9LMm7k3x+4U2swe4b3Z9M8nB3f2zpPetUVVdU1at3P395Ltzk8siyq9ajuz/S3ce7+9pc+P/9q9393oVnrU1VXb57U0uq6vIkb01yoO4i3ZrAdPdzST6Q5EwuvMn72e5+cNlV61NVn0nyjSSvr6onqur9S29aoxuSvC8XvoM9t/vx9qVHrcmVSe6qqgdy4ZusO7v70N2ue0i9JsndVfWdJPcm+bfu/tLCm37L1tymDMDBsjVXMAAcLAIDwAiBAWCEwAAwQmAAGCEwAIwQGABG/A9gCmL7XTdKRwAAAABJRU5ErkJggg==\n",
      "text/plain": [
       "<Figure size 504x504 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    }
   ],
   "source": [
    "# Convert from 1-index standard format. (Head is 0)\n",
    "event = dist.to_event(torch.tensor([[2, 3, 4, 1, 0, 4]]), None)\n",
    "show_deps(event[0])"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Non-Projective Dependency Tree"
   ]
  },
  {
   "cell_type": "raw",
   "metadata": {
    "raw_mimetype": "text/restructuredtext"
   },
   "source": [
    ".. autoclass:: torch_struct.NonProjectiveDependencyCRF"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 15,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAZgAAAGbCAYAAAD5r4b7AAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADh0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uMy4xLjEsIGh0dHA6Ly9tYXRwbG90bGliLm9yZy8QZhcZAAAQWUlEQVR4nO3deaild33H8c83s2QWbWJcm6VJLC5NpXUZ3NJKm0jRapVSabVGWksJFPcqVmvBtlBQkFQpIqQuUIxKif5hRdxQC60ldYxSs7jGmE1NNBrjxGRmMr/+MVNIk+c6Z5z7neecO68XBGbuOXn48Nx7532fc8+9p8YYAYD1dsLcAwDYmAQGgBYCA0ALgQGghcAA0GJzx0G3bN05tm17QMehj8q++9fcEyZt/fGBuSdM2nTa3rknTLrjpyfOPWHS1h/OvWBttaTPFh21nJ+TJ9y1b+4Jk/adtHXuCfex9/Zbs/+neybfkS2B2bbtAdn1pJd2HPqo3PBby/fOSZIzP/bTuSdMOvnN1889YdLn/+eX554w6eEfvHvuCWs6Yf9yfhFzYNNyPoiy7evfm3vCpJt+75fmnnAfX//Xi9a8bTnfuwCsPIEBoIXAANBCYABoITAAtBAYAFoIDAAtBAaAFgIDQAuBAaCFwADQQmAAaCEwALQQGABaLBSYqnpGVX21qr5RVa/rHgXA6jtsYKpqU5K3J3lmknOSvKCqzukeBsBqW+QK5olJvjHGuGaMsTfJB5I8t3cWAKtukcCcluSeL214w6G3/T9VdWFV7a6q3fv27VmvfQCsqHX7Jv8Y4+Ixxq4xxq4tW3au12EBWFGLBObGJGfc4++nH3obAKxpkcB8Pskjqursqtqa5PlJPtw7C4BVt/lwdxhj7K+qlyb5eJJNSd49xriyfRkAK+2wgUmSMcZHk3y0eQsAG4if5AeghcAA0EJgAGghMAC0EBgAWggMAC0EBoAWAgNAC4EBoIXAANBCYABoITAAtBAYAFos9NuUj9TekyrffsbWjkMflUf+881zT5j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XVe+dd9JSuyHJDWOM/7sqvjQHg8Panp7kW2OMW8YY+5J8KMlTZ950zC1rYD6f5BFVdXZVbc3Bb459eOZNS6uqKgcfH796jHHR3HuW3Rjj9WOM08cYZ+Xgx9anxxjH3VeXixpjfDfJ9VX1qENvOj/JVTNOWgXXJXlyVe049Pl5fo7DJ0ZsnnvAlDHG/qp6aZKP5+CzL949xrhy5lnL7NwkL0ry5ar60qG3/fUY46MzbmJjeVmSSw59wXdNkhfPvGepjTEuq6pLk1yeg8/y/GKOw18b41fFANBiWR8iA2DFCQwALQQGgBYCA0ALgQGghcAA0EJgAGjxv3t8wvogDeqAAAAAAElFTkSuQmCC\n",
      "text/plain": [
       "<Figure size 504x504 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    }
   ],
   "source": [
    "batch, N, N = 3, 10, 10\n",
    "def show_deps(tree):\n",
    "    plt.imshow(tree.detach())\n",
    "\n",
    "log_potentials = torch.rand(batch, N, N)\n",
    "dist = torch_struct.NonProjectiveDependencyCRF(log_potentials)\n",
    "show_deps(dist.marginals[0])"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Binary Labeled Tree"
   ]
  },
  {
   "cell_type": "raw",
   "metadata": {
    "raw_mimetype": "text/restructuredtext"
   },
   "source": [
    "    .. autoclass:: torch_struct.TreeCRF"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 16,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAagAAAGbCAYAAACRXATDAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADh0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uMy4xLjEsIGh0dHA6Ly9tYXRwbG90bGliLm9yZy8QZhcZAAAXKElEQVR4nO3df6zldX3n8edrASFQGMCpyK/1R2VJbFOn7gRl1za4WH5MjNiu24U0W6xupro1W5M1Dbsmatx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uHuu4dajy87xfXH+ADw+/mS8DWta57yc9wCguBs2nRspb7n4UQfQz4MQufZbyRhc9SPws8BPxf4Myh7VbgQ4te+4bh+N8L/Haj+vey8BnN4eP/8N225wA7j3acNaj9T4dj+j4WQufspbUP80e8P3Wof1j+kcPH+qK2rfb9cg+/6kiS1FL3S3ySpA3KgJIktWRASZJaMqAkSS0ZUJKklgwoSVJLBpQkqaX/D36Ig1JDrEwiAAAAAElFTkSuQmCC\n",
      "text/plain": [
       "<Figure size 504x504 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    }
   ],
   "source": [
    "batch, N, NT = 3, 20, 3\n",
    "def show_tree(tree):\n",
    "    t = tree.detach()\n",
    "    plt.imshow(t[ :, : , 0] + \n",
    "               2 * t[ :,:, 1] +\n",
    "               3 * t[ :,:, 2])\n",
    "\n",
    "log_potentials = torch.rand(batch, N, N, NT)\n",
    "dist = torch_struct.TreeCRF(log_potentials)\n",
    "show_tree(dist.argmax[0])"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 17,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAagAAAGbCAYAAACRXATDAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADh0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uMy4xLjEsIGh0dHA6Ly9tYXRwbG90bGliLm9yZy8QZhcZAAAaIklEQVR4nO3df5TddX3n8dcrk18N8iuyIARWpKZ06Q8iJ43apR5cLIaUQyrHbZNjK1bciMpZWet2qfSgpWfPWbdarcJKo2TBHorZarE5NSJZ21PqWUECGyARMDGLh4RIlEBCCJDMzHv/mG88l8m9M8Pcd2bed+b5OOeeuff7/dz3fc93vjOv+X7nO/fjiBAAANXMmOwGAABoh4ACAJREQAEASiKgAAAlEVAAgJJmTnYD7Rw3f2acvGB2Sq3d209IqSNJHki84nFwIK9W5pWYmRd1O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qWKHO36CVt/8pEbGruf9jSae0GdMrX4P3auhou53R9rPJclVzenJNh9OrvbDtf0PSUxGxtcP6qtteUv2A6nm2XyXpa5Kujoh9w1Y/oKHTTudK+rykr090f6M4PyLOk3SxpA/ZfstkN/RK2Z4t6VJJf9tmdfXt/zMxdD6mJ/8nxPa1kvol3dZhSMX97AuSfl7SIkm7NHSarBet1MhHTxW3/c9UD6idks5oeXx6s6ztGNszJR0v6ekJ6W4UtmdpKJxui4i/G74+IvZFxP7m/npJs2yfNMFtdhQRO5uPuyXdoaFTGq3G8vWZbBdLeiAinhq+ovr2l/TU4VOmzcfdbcaU/hrYfo+kSyS9qwnZI4xhP5twEfFURAxExKCkL3boqfq2nynpMklrO42puO1bVQ+o+yQttP265jfhFZLWDRuzTtLhK5feKekfO30jTKTm3O/Nkh6JiL/oMOY1h/9eZnuJhr4eVcL1GNvHHr6voT94bx42bJ2kdzdX871J0t6WU1JVdPwNsvL2b7Tu25dL+vs2Y74l6SLbJzanoS5qlk0620sl/ZGkSyPiQIcxY9nPJtywv6W+Q+17GsvPp8n0NkmPRsSOdiurbvuXmeyrNEa7aehKsR9o6GqZa5tl12top5ekuRo6fbNN0vcknTXZPTd9na+hUzIPSdrU3JZJulLSlc2YqyRt0dDVP/dI+vXJ7rul/7Oavh5sejy87Vv7t6Qbm6/Nw5IWT3bfwz6HYzQUOMe3LCu5/TUUorskHdLQ3zKu0NDfUr8taauk/y1pfjN2saQvtTz3vc3+v03SHxTqf5uG/kZzeP8/fLXtaZLWj7SfFej9r5t9+iENhc6pw3tvHh/x86lC/83yWw7v6y1jS2370W681REAoKTqp/gAANMUAQUAKImAAgCUREABAEoioAAAJRFQAICSCCgAQEn/H9TiSfFXa036AAAAAElFTkSuQmCC\n",
      "text/plain": [
       "<Figure size 504x504 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    }
   ],
   "source": [
    "show_tree(dist.marginals[0])"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Probabilistic Context-Free Grammar"
   ]
  },
  {
   "cell_type": "raw",
   "metadata": {
    "raw_mimetype": "text/restructuredtext"
   },
   "source": [
    "    .. autoclass:: torch_struct.SentCFG"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 18,
   "metadata": {},
   "outputs": [],
   "source": [
    "batch, N, NT, T = 3, 20, 3, 3\n",
    "def show_prob_tree(tree):\n",
    "    t = tree.detach().sum(-1).sum(-1)\n",
    "    plt.imshow(t[ :, : , 0] + \n",
    "               2 * t[ :,:, 1] +\n",
    "               3 * t[ :,:, 2])\n",
    "\n",
    "terminals = torch.rand(batch, N, T)\n",
    "rules = torch.rand(batch, NT, NT+T,  NT+T)\n",
    "init = torch.rand(batch, NT).log_softmax(-1)\n",
    "\n",
    "dist = torch_struct.SentCFG((terminals, rules, init))\n",
    "term, rules, init = dist.argmax"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 19,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAagAAAGbCAYAAACRXATDAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADh0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uMy4xLjEsIGh0dHA6Ly9tYXRwbG90bGliLm9yZy8QZhcZAAAWT0lEQVR4nO3dfaxc9X3n8fdnMQ+CQsAlITxtk7QUiVSJiywTdmlFlpQnodCHbBdUbUnDyk23SM1qq4rdSCTK/rPZKq22myism1iQKkvQtiVFWyfGSyvRSODEIAMmIeAgKmwILjiLQ2gJTr77xz2OLtczvjd3xr7f6/t+SaM55/x+8zvfOfd4PpwzhzmpKiRJ6uafLXUBkiSNYkBJkloyoCRJLRlQkqSWDChJUkurlrqAUY7L8XUCJ01lrJ99xytTGQfgiUdOnNpY+0+fzvsDWPXC96Y21jT5Hn88Xd+jllbXz7Bp+Se+x/fr1YxqaxlQJ3ASF+WyqYy1efP2qYw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8LtJfnGpC/pxJTkOeC/wv0c0d9/+P1Iz52OW5f8TkuTDwH7g82O6dNzPPg38NLAGeI6Z02TL0fUc+uip47b/ke4BtRs4d9b8OcOykX2SrALeALx4RKqbR5JjmQmnz1fVX85tr6p9VfXyML0JODbJ6Ue4zLGqavfwvAe4i5lTGrMt5O+z1K4CHqqq5+c2dN/+wPMHTpkOz3tG9Gn9N0jyfuAa4DeGkD3IAvazI66qnq+qH1TVD4E/HVNT922/CvhV4M5xfTpu+9m6B9TXgPOSvHX4L+HrgLvn9LkbOHDl0vuAvxn3D+FIGs79fhb4RlX90Zg+bz7wfVmSdcz8PbqE60lJTj4wzcwX3jvmdLsb+M3har53AS/NOiXVxdj/guy8/Qez9+0bgL8a0WczcHmS04bTUJcPy5ZckiuBPwDeW1WvjOmzkP3siJvzXeqvMLqmhXw+LaX3AI9X1a5RjV23/ess9VUa8z2YuVLsCWaulvnwsOxjzOz0ACcwc/pmJ/BV4G1LXfNQ1yXMnJJ5BNg+PK4GPgh8cOhzE/AYM1f/PAD8i6Wue1b9bxvqenio8cC2n11/gE8Nf5tHgbVLXfec93ASM4HzhlnLWm5/ZkL0OeA1Zr7LuJGZ71LvBZ4E/i+weui7FvjMrNd+YNj/dwK/1aj+ncx8R3Ng/z9wte1ZwKZD7WcNav+zYZ9+hJnQOXNu7cP8QZ9PHeoflt92YF+f1bfVtp/v4U8dSZJa6n6KT5K0QhlQkqSWDChJUksGlCSpJQNKktSSASVJasmAkiS19P8BgVI4g1erTs0AAAAASUVORK5CYII=\n",
      "text/plain": [
       "<Figure size 504x504 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    }
   ],
   "source": [
    "# Rules\n",
    "show_prob_tree(rules[0])"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 20,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "<matplotlib.image.AxesImage at 0x7f6e90f0db38>"
      ]
     },
     "execution_count": 20,
     "metadata": {},
     "output_type": "execute_result"
    },
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAbQAAAA2CAYAAACvO2whAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADh0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uMy4xLjEsIGh0dHA6Ly9tYXRwbG90bGliLm9yZy8QZhcZAAAI2ElEQVR4nO3df+xVdR3H8ecrUdrU6RdpSuQ0qln0RwnfmZU5F0jqGvTDNVxbmDZyxcq2VmxszvkX2qqt1mqELHPOWJpKTacYuv6CBAcK/gIcTRmCIkGszcLe/XE+lx0v59x7+d7zvefc6+ux3d1z7/ncc94fP59733zPj7eKCMzMzIbde+oOwMzMrApOaGZmNhKc0MzMbCQ4oZmZ2UhwQjMzs5HghGZmZiOhr4QmaZqk9ZJ2puexknZvS9qaHuv62aeZmVkR9XMfmqQ7gDcjYqWk5cBYRPy4oN3RiDijjzjNzMw66jehvQhcERH7JM0AnoyIiwraOaGZmdmk6jeh/TMizk7LAg61Xre1OwZsBY4BKyPiwZLtLQWWApwOcz864chOtGVuUzcGc9lS2ba2UG1szK0utgo3VbmKh/Rd1VebmCrnSOVj2uhJsuWNiHhf0ZquCU3S48B5BatWAHflE5ikQxFxwnk0STMjYq+kWcAGYF5E7O6033EpNneM7OSoygpflW4MAlW2LVFxKbOoLrYKN1W5iof0XdVXm5gq50jlY9roSaItETFetGZKt49GxPzSzUr7Jc3IHXI8ULKNven5ZUlPAhcDHROamZnZyej3sv11wJK0vAR4qL2BpDFJU9PydOCzwHN97tfMzOwd+k1oK4ErJe0E5qfXSBqXtDq1+RiwWdI24Amyc2hOaGZmVqm+LgqZTD6HNjE+hzYxPodmg+ZzaBNVfg7NlULMzGwkVJLQJF0l6UVJu9IN1u3rp0pam9ZvknRhFfs1MzNr6TuhSToF+BVwNTAbuE7S7LZmN5Ldo/Zh4OfA7f3u18zMLK+Kv9AuAXZFxMsR8R/gD8CitjaLg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DihmZnZSHBCMzOzkeCEZmZmI+H/XmRvo146rRcAAAAASUVORK5CYII=\n",
      "text/plain": [
       "<Figure size 504x504 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    }
   ],
   "source": [
    "# Terminals\n",
    "plt.imshow(term[:1])"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Autoregressive / Beam Search"
   ]
  },
  {
   "cell_type": "raw",
   "metadata": {
    "raw_mimetype": "text/restructuredtext"
   },
   "source": [
    "    .. autoclass:: torch_struct.Autoregressive\n",
    "         :members: sample,sample_without_replacement,greedy_max,beam_topk\n",
    "    .. autoclass:: torch_struct.AutoregressiveModel\n",
    "    "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 37,
   "metadata": {},
   "outputs": [],
   "source": [
    "batch, N, C, H, layer = 3, 10, 4, 5, 1\n",
    "init = (torch.rand(batch, layer, H), \n",
    "        torch.rand(batch, layer, H))\n",
    "def t(a):                                                                                                                                                                    \n",
    "    return [t.transpose(0, 1) for t in a]\n",
    "\n",
    "def show_ar(chain):\n",
    "     plt.imshow(chain.detach().transpose(0, 1))\n",
    "\n",
    "class RNN_AR(torch.nn.Module):                                                                                                                                                   \n",
    "    def __init__(self):                                                                                                                                                      \n",
    "        super().__init__()                                                                                                                                                   \n",
    "        self.rnn = torch.nn.LSTM(H, H, batch_first=True)                                                                                                                     \n",
    "        self.proj = torch.nn.Linear(H, C)                                                                                                                                    \n",
    "        self.embed = torch.nn.Embedding(C, H)                                                                                                                                \n",
    "\n",
    "    def forward(self, inputs, state):                                                                                                                                        \n",
    "        inputs = self.embed(inputs)                                                                                                                                          \n",
    "        out, state = self.rnn(inputs, t(state))\n",
    "        return self.proj(out), t(state)\n",
    "    \n",
    "dist = torch_struct.Autoregressive(RNN_AR(), init, C, N)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 38,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KG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7a3rHpnHe9sZ52xvnbe+cO0/NATBMiAAYtQkhOjM9YEM5b3vjvO2N87Z3iz93B/41IgAOt014RATAIXagQ1RV91XV16vqqar68PSeTVBVt1TVY1X1ZFVdqKoHpjdtkqo6UlVfrqrPTG/ZFFX1pqp6uKq+VlUXq+qXpjdtgqr6vZ2/o1+tqk9U1fHpTVMObIiq6kiSjyZ5Z5JTSe6vqlOzqzbCK0k+1N2nkrwjyW87b6/LA0kuTo/YMH+a5G+7++eS/Hycv11V1Ykkv5tkq7vfluRIkvfOrppzYEOU5M4kT3X30939UpJPJnnP8KYDr7uf6+4ndr7/Qbb/UTgxu2ozVNXJJO9O8rHpLZuiqn4iya8k+XiSdPdL3f292VUb42iSN1TV0SQ3JPm34T1jDnKITiR55rKfL8U/qK9LVd2a5I4kj88u2Rh/kuT3k/zX9JANcluSF5L8+c5Tmh+rqhunRx103f1skj9O8q0kzyX5j+7+u9lVcw5yiLgKVfXGJJ9K8sHu/v70noOuqn49yfPd/aXpLRvmaJJfSPJn3X1Hkv9M4vXcXVTVT2b7GZ7bktyc5Maq+s3ZVXMOcoieTXLLZT+f3LmNXVTVsWxH6KHufmR6z4a4K8lvVNU3s/008N1V9VezkzbCpSSXuvt/HnU/nO0w8f/71ST/0t0vdPfLSR5J8svDm8Yc5BB9Mcmbq+q2qrou2y/kfXp404FXVZXt5+svdvdHpvdsiu7+g+4+2d23ZvvP2t9392L/h7qq7v73JM9U1Vt3bronyZODkzbFt5K8o6pu2Pk7e08WfJHH0ekBr6W7X6mqDyQ5m+0rSh7s7gvDszbBXUnel+Sfq+r8zm1/2N2PDm7icPudJA/t/Ifx6STvH95z4HX341X1cJInsn2l65ez4HdY8M4KAIw6yE/NAbAAQgTAKCECYJQQATBKiAAYJUQAjBIiAEYJEQCj/hsRrcUKP9QnkAAAAABJRU5ErkJggg==\n",
      "text/plain": [
       "<Figure size 504x504 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    }
   ],
   "source": [
    "path = dist.greedy_argmax()\n",
    "show_ar(path[0])"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 39,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "tensor([[-11.9900, -11.9229, -11.8859]], grad_fn=<ViewBackward>)"
      ]
     },
     "execution_count": 39,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "dist.log_prob(path.unsqueeze(0))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 40,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAaIAAAC7CAYAAAAnpZqIAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADh0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uMy4xLjEsIGh0dHA6Ly9tYXRwbG90bGliLm9yZy8QZhcZAAAItklEQVR4nO3dX4ilh1nH8d/j7ibbpGJFc2F2g8lFW1lKTWSI1YAXiZK0FXvbgL0owt5YTaUg1TvvpehFEZY2KhhaJM1FKdG1YKAUauw2XWs325YQa7MxkrSltrWQfz5ezAirbJyT2Tn7zJn384GBmXOGlx8vu/vdc87LOdXdAYApPzY9AIBlEyIARgkRAKOECIBRQgTAKCECYNTRdRz0urq+j+fGdRz6qr3l7T+angCwON985uV8+7uv1pXuW0uIjufG/GLds45DX7WzZ89PTwBYnDvvfeY17/PUHACjhAiAUUIEwCghAmCUEAEwSogAGCVEAIwSIgBGCREAo4QIgFFCBMAoIQJglBABMEqIABi1Uoiq6r6q+npVPVVVH173KACWY9cQVdWRJB9N8s4kp5LcX1Wn1j0MgGVY5RHRnUme6u6nu/ulJJ9M8p71zgJgKVYJ0Ykkl3+03qWd2/6XqjpdVeeq6tzLeXG/9gFwyO3bxQrdfaa7t7p761iu36/DAnDIrRKiZ5PcctnPJ3duA4CrtkqIvpjkzVV1W1Vdl+S9ST693lkALMXR3X6hu1+pqg8kOZvkSJIHu/v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392L/h7qq7v73JM9U1Vt3bronyZODkzbFt5K8o6pu2Pk7e08WfJHH0ekBr6W7X6mqDyQ5m+0rSh7s7gvDszbBXUnel+Sfq+r8zm1/2N2PDm7icPudJA/t/Ifx6STvH95z4HX341X1cJInsn2l65ez4HdY8M4KAIw6yE/NAbAAQgTAKCECYJQQATBKiAAYJUQAjBIiAEYJEQCj/hsRrcUKP9QnkAAAAABJRU5ErkJggg==\n",
      "text/plain": [
       "<Figure size 504x504 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    },
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAaIAAAC7CAYAAAAnpZqIAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADh0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uMy4xLjEsIGh0dHA6Ly9tYXRwbG90bGliLm9yZy8QZhcZAAAIh0lEQVR4nO3dX4ilB3nH8d/jzJi4WrStuai7SzcXoixCTRmCbaAXscXYlnprQC9KYW+0jUUotne9L9JeSGHRtIUGpcRciERToYEitNE1pupmVUJqzaYpiYpVe2H+9OnFTEtaNp2Tcc4+c+b9fGBg5pzDy4+XnfnOOfNytro7ADDlFdMDAFg2IQJglBABMEqIABglRACMEiIARm2v46Cv/5mtPnd2Zx2HBmADfeuJ5/Kd771Q17pvLSE6d3YnX3jg7DoODcAGuvUdT7zkfV6aA2CUEAEwSogAGCVEAIwSIgBGCREAo4QIgFFCBMAoIQJglBABMEqIABglRACMEiIARgkRAKNWClFV3VFV36iqx6rqQ+seBcByHBiiqtpK8pEk70xyPsmdVXV+3cMAWIZVnhHdmuSx7n68u59N8okk71rvLACWYpUQnU7y4v9a7+r+bf9LVV2oqktVdemZ775wVPsAOOGO7GKF7r7Y3bvdvXvTz24d1WEBOOFWCdGTSc6+6Osz+7cBwE9slRB9Mckbq+rmqnplkncn+dR6ZwGwFNsHPaC7n6+q9yd5IMl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7J3Rcnd3X15eNYmuC3Je5N8taoe2b/tj7r7/sFNnGy/m+Se/V8YH0/y28N7jr3ufqiq7k3ycPaudP1yFvwOC95ZAYBRx/mlOQAWQIgAGCVEAIwSIgBGCREAo4QIgFFCBMAoIQJg1H8BmHm7Uo+2XqQAAAAASUVORK5CYII=\n",
      "text/plain": [
       "<Figure size 504x504 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    },
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAaIAAAC7CAYAAAAnpZqIAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADh0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uMy4xLjEsIGh0dHA6Ly9tYXRwbG90bGliLm9yZy8QZhcZAAAIxElEQVR4nO3dX4ilh1nH8d/j7ibbpGJFc2F2F5OLWlmKTWSI1YAXiZJUxd42YC+KkBvbplKQ6p33UvSiCEsbFQwtkuailOhaNCAF3XabrrWbbSXE2mwaSWqoaRXyz8eLGWWVrXMymbPPnHk/H1iYOefw8uPdP98957ycqe4OAEz5gekBACybEAEwSogAGCVEAIwSIgBGCREAo46u46DX1fV9PDeu49AM+Ymf+o/pCcAG+8bTr+TbL7xWV7tvLSE6nhvzM3X3Og7NkLNnL0xPADbYHfc8/X3v89IcAKOECIBRQgTAKCECYJQQATBKiAAYJUQAjBIiAEYJEQCjhAiAUUIEwCghAmCUEAEwSogAGLVSiKrq3qr6elU9WVUfWfcoAJZj1xBV1ZEkH0vyriSnk9xXVafXPQyAZVjlGdEdSZ7s7qe6++Ukn0ry7vXOAmApVgnRiSRX/mi9yzu3/S9VdX9Vna+q86/kpf3aB8Aht28XK3T3me7e6u6tY7l+vw4LwCG3SoieSXLqiu9P7twGAG/YKiH6YpK3VtWtVXVdkvck+cx6ZwGwFEd3e0B3v1pV709yNsmRJA9298W1LwNgEXYNUZJ096NJHl3zFgAWyCcrADBKiAAYJUQAjBIiAEYJEQCjhAiAUUIEwCghAmCUEAEwSogAGCVEAIwSIgBGCREAo6q79/2gW+843l84e2r3Bw645+bbpicALM65/qu82C/U1e7zjAiAUUIEwCghAmCUEAEwSogAGCVEAIwSIgBGCREAo4QIgFFCBMAoIQJglBABMEqIABglRACMEiIARgkRAKN2DVFVPVhVz1XVV6/FIACWZZVnRH+c5N417wBgoXYNUXf/TZIXrsEWABZo394jqqr7q+p8VZ1//l9f26/DAnDI7VuIuvtMd29199ZNP3Jkvw4LwCHnqjkARgkRAKNWuXz7k0n+NsnbqupyVf36+mcBsBRHd3tAd993LYYAsExemgNglBABMEqIABglRACMEiIARgkRAKOECIBRQgTAKCECYJQQATBKiAAYJUQAjBIiAEbt+unbe/GPX7kh99x82zoO/Yad/daF6Qkb6aD+fgKbzzMiAEYJEQCjhAiAUUIEwCghAmCUEAEwSogAGCVEAIwSIgBGCREAo4QIgFFCBMAoIQJglBABMEqIABglRACM2jVEVXWqqh6rqieq6mJVPXAthgGwDKv8hNZXk3y4ux+vqh9M8qWq+lx3P7HmbQAswK7PiLr72e5+fOfr7ya5lOTEuocBsAyrPCP6H1V1S5Lbk5y7yn33J7k/SY7nhn2YBsASrHyxQlW9Ocmnk3you1/8v/d395nu3ururWO5fj83AnCIrRSiqjqW7Qg91N2PrHcSAEuyylVzleQTSS5190fXPwmAJVnlGdGdSd6b5K6qurDz65fWvAuAhdj1YoXu/nySugZbAFggn6wAwCghAmCUEAEwSogAGCVEAIwSIgBGCREAo4QIgFFCBMAoIQJglBABMEqIABglRACMEiIARu36YyAOm3tuvm16AgBX8IwIgFFCBMAoIQJglBABMEqIABglRACMEiIARgkRAKOECIBRQgTAKCECYJQQATBKiAAYJUQAjBIiAEbtGqKqOl5VX6iqv6+qi1X1u9diGADLsMoPxnspyV3d/b2qOpbk81X15939d2veBsAC7Bqi7u4k39v59tjOr17nKACWY6X3iKrqSFVdSPJcks9197mrPOb+qjpfVedfyUv7vROAQ2qlEHX3a919W5KT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w/XT3q1X1/iRns31FyYPdfXF41ia4M8l7k/xDVV3Yue13uvvRwU0cbh9I8tDOfxifSvK+4T0HXnefq6qHkzye7Stdv5wFf8KCT1YAYNRBfmkOgAUQIgBGCREAo4QIgFFCBMAoIQJglBABMEqIABj1X+NEzSHZwl0WAAAAAElFTkSuQmCC\n",
      "text/plain": [
       "<Figure size 504x504 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    }
   ],
   "source": [
    "out = dist.beam_topk(5)[:, 0]\n",
    "for i in range(3):\n",
    "    show_ar(out[i])\n",
    "    plt.show()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 43,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "torch.Size([5, 10, 4])\n"
     ]
    },
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAaIAAAC7CAYAAAAnpZqIAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADh0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uMy4xLjEsIGh0dHA6Ly9tYXRwbG90bGliLm9yZy8QZhcZAAAI7UlEQVR4nO3dX4ilh1nH8d/jzibbpNa2mguzG0wuamUpNZEhqQa8yCpJVextA/aiFPbGaioFqd55L0UvirC0UcHQImkuSomupQakoGu36dZ2sy2E2DabRBItNW2l+VMfL2aUKBvnZHrOPnPmfD6wMGfO4eXHu7Pz3XPm5Ux1dwBgyo9MDwBgswkRAKOECIBRQgTAKCECYJQQATBqaxUHvaau7WO5fhWHBmANfT/fy4v9Ql3pvpWE6Fiuzx11ahWHBmANnevPvup9XpoDYJQQATBKiAAYJUQAjBIiAEYJEQCjhAiAUUIEwCghAmCUEAEwSogAGCVEAIwSIgBGCREAoxYKUVXdU1Vfq6rHq+pDqx4FwObYM0RVdSTJR5K8M8nJJPdW1clVDwNgMyzyjOj2JI939xPd/WKSTyR512pnAbApFgnR8SRPvuL25d3P/S9VdbqqzlfV+ZfywrL2AXDILe1ihe4+093b3b19NNcu67AAHHKLhOipJDe94vaJ3c8BwA9tkRB9PslbquqWqromybuTfGq1swDYFFt7PaC7X66q9yc5m+RIkvu7++LKlwGwEfYMUZJ098NJHl7xFgA2kHdWAGCUEAEwSogAGCVEAIwSIgBGCREAo4QIgFFCBMAoIQJglBABMEqIABglRACMEiIARi307tuv1U+//T9y9uyFVRz6ULv7xlunJ6yls0/7Wtuvg/w15+91fw7y3+mr8YwIgFFCBMAoIQJglBABMEqIABglRACMEiIARgkRAKOECIBRQgTAKCECYJQQATBKiAAYJUQAjBIiAEYJEQCj9gxRVd1fVc9W1VeuxiAANssiz4j+LMk9K94BwIbaM0Td/XdJvnUVtgCwgZb2M6KqOl1V56vq/HP/9oNlHRaAQ25pIeruM9293d3bN/z4kWUdFoBDzlVzAIwSIgBGLXL59seT/H2St1bV5ap63+pnAbAptvZ6QHffezWGALCZvDQHwCghAmCUEAEwSogAGCVEAIwSIgBGCREAo4QIgFFCBMAoIQJglBABMEqIABglRACMqu5e+kHfUG/uO+rU0o972J19+sL0hLV09423Tk+AA+Ogfh+5/e4nc/5L368r3ecZEQCjhAiAUUIEwCghAmCUEAEwSogAGCVEAIwSIgBGCREAo4QIgFFCBMAoIQJglBABMEqIABglRACMEiIARu0Zoqq6qaoeqarHqupiVd13NYYBsBm2FnjMy0k+2N2PVtWPJvlCVX2mux9b8TYANsCez4i6+5nufnT34+8kuZTk+KqHAbAZFnlG9D+q6uYktyU5d4X7Tic5nSTHct0SpgGwCRa+WKGqXp/kk0k+0N3P/9/7u/tMd2939/bRXLvMjQAcYguFqKqOZidCD3T3Q6udBMAmWeSquUrysSSXuvvDq58EwCZZ5BnRnUnek+Suqrqw++dXVrwLgA2x58UK3f25JHUVtgCwgbyzAgCjhAiAUUIEwCghAmCUEAEwSogAGCVEAIwSIgBGCREAo4QIgFFCBMAoIQJglBABMEqIABhV3b30g76h3tx31KmlHxdYrrNPX5ie8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5Ibk1xfVb8xu2rOQQ7RU0luesXtE7ufYw9VdTQ7EXqgux+a3rMm7kzy61X19ey8DHxXVf3F7KS1cDnJ5e7+72fdD2YnTPz/finJP3f3c939UpKHkvzC8KYxBzlEn0/ylqq6paquyc4P8j41vOnAq6rKzuv1l7r7w9N71kV3/153n+jum7Pztfa33b2x/0NdVHf/S5Inq+qtu586leSxwUnr4ptJ3lFV1+3+mz2VDb7IY2t6wKvp7per6v1JzmbnipL7u/vi8Kx1cGeS9yT5clVd2P3c73f3w4ObONx+K8kDu/9hfCLJe4f3HHjdfa6qHkzyaHaudP1iNvgdFryzAgCjDvJLcwBsACECYJQQATBKiAAYJUQAjBIiAEYJEQCjhAiAUf8FNzXdQ4yy/esAAAAASUVORK5CYII=\n",
      "text/plain": [
       "<Figure size 504x504 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    },
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAaIAAAC7CAYAAAAnpZqIAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADh0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uMy4xLjEsIGh0dHA6Ly9tYXRwbG90bGliLm9yZy8QZhcZAAAJC0lEQVR4nO3dXajkh1nH8d/j7ibbpNr6kgv3BZOLWlmK3cghrQa8SJRNVextA/ZChL2xmkpBqnfeS9GLIixtVDC0SJqLUqJrqQEp6LbbdK3dbCshrc0mkaSGmlYhbz5enKNE2e05OZnZZ2bn84GFc2aGPz/+7J7vzsyfOdXdAYApPzA9AIDNJkQAjBIiAEYJEQCjhAiAUUIEwKiDyzjoDXVjH87Nyzj0G/aTP/2f0xNYsH/+yk3TE2BlrOrPuG8++XK+/fyrdaX7lhKiw7k576q7l3HoN+zs2QvTE1iwU0dOTk+AlbGqP+PuOPXkVe/z0hwAo4QIgFFCBMAoIQJglBABMEqIABglRACMEiIARgkRAKOECIBRQgTAKC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00PWSO3JXkuyZ/uvKT5saq6eXrUquvup5L8YZJvJXkmyb9399/MrpqzyiHiDaiqNyf5VJIPdvcL03tWXVX9SpJnu/tL01vWzMEkP5PkT7r79iT/kcT7ubuoqh/O9is8tyU5kuTmqvq12VVzVjlETyU5/prvj+3cxi6q6lC2I/RAdz80vWdN3JnkV6vqm9l+GfiuqvqL2Ulr4XKSy939P8+6H8x2mPj+fiHJN7r7ue5+OclDSX5ueNOYVQ7RF5O8rapuq6obsv1G3qeHN628qqpsv15/qbs/Mr1nXXT373X3se6+Ndt/1/62uzf2f6h71d3/muTJqnr7zk13J3lscNK6+FaSd1fVTTv/Zu/OBl/kcXB6wNV09ytV9YEkZ7N9Rcn93X1xeNY6uDPJ+5P8U1Vd2Lnt97v74cFNXN9+K8kDO/9hfCLJrw/vWXndfa6qHkzyaLavdP1yNvgTFnyyAgCjVvmlOQA2gBABMEqIABglRACMEiIARgkRAKOECIBRQgTAqP8GILTnOIIcb/8AAAAASUVORK5CYII=\n",
      "text/plain": [
       "<Figure size 504x504 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    },
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAaIAAAC7CAYAAAAnpZqIAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADh0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uMy4xLjEsIGh0dHA6Ly9tYXRwbG90bGliLm9yZy8QZhcZAAAJGElEQVR4nO3dXYjlh1nH8d/j7ibbpNZazYX7gslFrSzFbmRIqgEvssqmKva2AXshwt5YTaUg1TvvpehFEZY2KhhaJM1FKdG1xIAUdNttun3ZbCsharNJJNFQ01aal/p4MaNEu+tMpufsM2fO5wMLc1748+PP7H73nPNnpro7ADDlB6YHALDehAiAUUIEwCghAmCUEAEwSogAGHVwGQe9oW7sw7l5GYeG7/ETP/Uf0xOu6R++dNP0BNgTvpNv5+V+q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/t7se2vv5mNv9RODq7ajVU1bEkv5TkI9NbVkVV/VCSn0vy0STp7pe7+xuzq1bGwSRvqKqDSW5K8szwnjF7OURHkzz1mttX4h/U16Wqbk1ye5Lzs0tWxh8m+Z0k/zk9ZIXcluT5JH+y9ZbmR6rq5ulRe113P53kD5J8PcmzSf69u/96dtWcvRwivg9V9cYkn0jy/u5+cXrPXldVv5zkue7+/PSWFXMwyU8n+ePuvj3Jt5P4PHcbVfXD2XyH57YkR5LcXFW/Ortqzl4O0dNJjr/m9rGt+9hGVR3KZoQe6O6HpvesiLuS/EpV/VM23wa+u6r+fHbSSriS5Ep3//er7gezGSb+fz+f5B+7+/nufiXJQ0l+dnjTmL0cos8leWtV3VZVN2Tzg7xPDm/a86qqsvl+/eXu/tD0nlXR3b/b3ce6+9Zsfq/9TXev7f9Qd6q7/yXJU1X1tq27TiV5fHDSqvh6kndW1U1bf2dPZY0v8jg4PeBauvvVqnpfknPZvKLk/u6+NDxrFdyV5L1JvlxVF7fu+73ufnhwE/vbbyZ5YOs/jE8m+bXhPXted5+vqgeTPJbNK12/kDX+CQt+sgIAo/byW3MArAEhAmCUEAEwSogAGCVEAIwSIgBGCREAo4QIgFH/BT+r7fPKwGH+AAAAAElFTkSuQmCC\n",
      "text/plain": [
       "<Figure size 504x504 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    }
   ],
   "source": [
    "out = dist.sample((5,))[:, 0 ]\n",
    "print(out.shape)\n",
    "for i in range(3):\n",
    "    show_ar(out[i])\n",
    "    plt.show()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 44,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAaIAAAC7CAYAAAAnpZqIAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADh0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uMy4xLjEsIGh0dHA6Ly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Oj09IAN5bxdHeft6jhvV2/rz93av0cEwMG2Cc+IADjA1jpEVXVvVX29qp6oqg9N79kEVXVLVT1aVY9X1YWqun960yapqkNV9aWq+vT0lk1RVW+pqoeq6mtVdbGqfmZ60yaoqt/ee4x+tao+XlVHpzdNWdsQVdWhJB9J8u4kJ5LcV1UnZldthFeTfLC7TyR5V5LfcN7ekPuTXJwesWH+KMlfdfdPJnlHnL99VdXNSX4ryU53vz3JoSTvnV01Z21DlOSOJE9095Pd/XKSTyR5z/Cmtdfdz3b3Y3uffye7/yjcPLtqM1TV8SS/lOSj01s2RVX9YJKfS/KxJOnul7v727OrNsbhJG+qqsNJbkjyzPCeMescopuTPPW6ry/FP6hvSFXdmuT2JGdnl2yMP0zyO0n+c3rIBrktyfNJ/mTvJc2PVtWN06PWXXc/neQPknwzybNJ/q27/3p21Zx1DhHfg6p6c5JPJvlAd784vWfdVdUvJ3muu784vWXDHE7y00n+uLtvT/LvSbyfu4+q+qHsvsJzW5JjSW6sql+dXTVnnUP0dJJbXvf18b3vsY+qOpLdCD3Y3Q9P79kQdyb5lar6RnZfBr6rqv58dtJGuJTkUnf/97Puh7IbJv5/P5/kn7r7+e5+JcnDSX52eNOYdQ7RF5K8tapuq6rrsvtG3qeGN629qqrsvl5/sbs/PL1nU3T373b38e6+Nbs/a3/T3Vv7P9RFdfe/JHmqqt629627kzw+OGlTfDPJu6rqhr3H7N3Z4os8Dk8PuJLufrWq3p/kTHavKHmguy8Mz9oEdyZ5X5KvVNX5ve/9Xnc/MriJg+03kzy49x/GJ5P82vCetdfdZ6vqoSSPZfdK1y9li3/Dgt+sAMCodX5pDoAtIEQAjBIiAEYJEQCjhAiAUUIEwCghAmCUEAEw6r8AYyHpp339gWcAAAAASUVORK5CYII=\n",
      "text/plain": [
       "<Figure size 504x504 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    },
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAaIAAA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
       "<Figure size 504x504 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    },
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAaIAAAC7CAYAAAAnpZqIAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADh0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uMy4xLjEsIGh0dHA6Ly9tYXRwbG90bGliLm9yZy8QZhcZAAAJEklEQVR4nO3dXYjlh1nH8d/j7ibbTa21mgv3BZOLWlmK3ciQVgNeJEpSFXvbgL0QYW+splKQ6p33UvSiCEsbFQwtkuailOhaYkAKuu02XWM325YQtdkkkmio2xfMS328mFGibDKz03P2mTPn84GFmTmHPz/+zOx3zzn/PVPdHQCY8gPTAwBYb0IEwCghAmCUEAEwSogAGCVEAIw6uIyD3lA39uHctIxD72s/8VPfnZ7Agn398SPTE97QXv6e2+vnjmvzn/lOXu6X6mq31TL+H9Fb6m397rpr4cfd784+e2F6Agt299FT0xPe0F7+ntvr545rc64fyZV+8aoh8tQcAKOECIBRQgTAKCECYJQQATBKiAAYJUQAjBIiAEYJEQCjhAiAUUIEwCghAmCUEAEwSogAGLWjEFXVPVX1tap6sqo+suxRAKyPbUNUVQeSfCzJe5OcTHJvVZ1c9jAA1sNOHhHdnuTJ7n6qu19O8qkk71vuLADWxU5CdCzJ06/5/PLW1/6PqjpdVeer6vwreWlR+wDY5xZ2sUJ3n+nuje7eOJQbF3VYAPa5nYTomSQnXvP58a2vAcD3bSch+mKSt1fVrVV1Q5L3J/nMcmcBsC4ObneH7n61qj6Y5GySA0nu7+6LS18GwFrYNkRJ0t0PJ3l4yVsAWEPeWQGAUUIEwCghAmCUEAEwSogAGCVEAIwSIgBGCREAo4QIgFFCBMAoIQJglBABMEqIABhV3b3wg26863B/4eyJ7e844O6jp6YnAKydc/1IrvSLdbXbPCICYJQQATBKiAAYJUQAjBIiAEYJEQCjhAiAU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VQ8meSybV7p+OWv8DgveWQGAUXv5qTkA1oAQATBKiAAYJUQAjBIiAEYJEQCjhAiAUUIEwKj/Bo0v7TYvt645AAAAAElFTkSuQmCC\n",
      "text/plain": [
       "<Figure size 504x504 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    }
   ],
   "source": [
    "out = dist.sample_without_replacement((5,))[:, 0]\n",
    "for i in range(3):\n",
    "    show_ar(out[i])\n",
    "    plt.show()"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Base Class"
   ]
  },
  {
   "cell_type": "raw",
   "metadata": {
    "raw_mimetype": "text/restructuredtext"
   },
   "source": [
    ".. autoclass:: torch_struct.StructDistribution\n",
    "   :members:  "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 27,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAbQAAACSCAYAAAAttj/ZAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADh0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uMy4xLjEsIGh0dHA6Ly9tYXRwbG90bGliLm9yZy8QZhcZAAAKrklEQVR4nO3df6xfd13H8eeL225zQ9iki5S2cTNUlChu46ZKZpbFMemQrCZgsiXqIJKbGKaoMbppMiJ/Tf/wVySQpat0CgxTRK+koW7ZCBIC7A47YBsd14akt5t2tGNQUWbH2z/u6XJ3/bYd+577Pfd++nwk39zz49Pzfp/c3Pvq95zP99xUFZIkrXUvGboBSZL6YKBJkppgoEmSmmCgSZKaYKBJkppgoEmSmjBWoCX5oST3JPla9/WiU4x7Nsn+7jU7Tk1JkkbJOJ9DS/KnwLGquj3JLcBFVfUHI8Ydr6qXjtGnJEmnNW6gHQCurqonkmwEPlVVrxkxzkCTJK2ocQPtm1V1Ybcc4KmT68vGnQD2AyeA26vqH09xvBlgBuCC8/P6H3/1OS+6t9XusS+dP3Q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Qm/B8gRgMcTDRDtwAAAABJRU5ErkJggg==\n",
      "text/plain": [
       "<Figure size 504x504 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    },
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAbQAAACSCAYAAAAttj/ZAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADh0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uMy4xLjEsIGh0dHA6Ly9tYXRwbG90bGliLm9yZy8QZhcZAAAKsElEQVR4nO3df6xfd13H8eeLttvcEDbpIqVt3Ax1ShS3cVM1M0vjmHRIVhMx2RJ1EMlNDFPQGNggGZG/pn/4KxLI0lU6RYYZolfSWEc2gsYAu8PyYxsd14akt5t0tGNQEUbH2z/u6fLd9dvbse+599z76fORfHPP55xPz+d9ctL76jnn8z1NVSFJ0lr3oqELkCSpDwaaJKkJBpokqQkGmiSpCQaaJKkJBpokqQkTBVqSH0lyb5KvdD8vOk2/Z5Ic6D4zk4wpSdI4meR7aEn+BDheVbcnuQW4qKreOabfiap68QR1SpK0pEkD7SCwo6oeT7IJ+GRVXTamn4EmSVpWkwbaN6rqwm45wJOn2ov6nQQOACeB26vqH0+zv2lgGuCC8/Oan3zlOS+4ttXu0S+cP3QJy+onXv3toUtYVi2fP8+dVrNv8eTXq+ricdvOGGhJPgG8fMymdwN7RwMsyZNV9f+eoyXZXFVHkvw4cB9wTVX911LjTv3sefXZ/VuXrG0te90rLh+6hGW1/7EDQ5ewrFo+f547rWafqHserKqpcdvWn+kPV9VrT7ctydeSbBq55Xj0NPs40v08lOSTwBXAkoEmSdIPYtJp+zPATd3yTcA/Le6Q5KIk53bLG4GrgIcnHFeSpOeYNNBuB65N8hXgtV2bJFNJdnd9fgqYTfJ54H4WnqEZaJKkXp3xluNSquoYcM2Y9bPAW7rl/wB+ZpJxJEk6E98UIklqgoEmSWqCgSZJaoKBJklqgoEmS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MVQ9XqHBdmCuqg5V1dPA3cCugWvqTeuvJauqx6vqc93yt4BHgM3DVtWPWnCia27oPk39CzTJFuBXgN1D16IfTJKXAlcDdwJU1dNDhhkYaLDwy+/wSHueRn4hnm26t9VcAXxm2Er6092OOwAcBe6tqmaOrfPnwDuA7w9dyDIp4F+TPNi92q8llwJPAH/d3TLeneSCIQsy0NSEJC9m4X2hb6+qbw5dT1+q6pmquhzYAmxP0sxt4yRvAI5W1YND17KMfrGqrgSuA97aPQJoxXrgSuD9VXUF8D/AoHMQDDQ4AmwdaW/p1mmN6J4vfRT4UFX9w9D1LIfuVs79wM6ha+nRVcD13XOmu4FfSvK3w5bUr6o60v08CnyMhUccrZgH5kfuGtzDQsANxkBbmASyLcml3UPNG4CZgWvS89RNnLgTeKSq/nToevqU5OIkF3bLP8TCxKUvD1tVf6rq1qraUlWXsPD37r6q+o2By+pNkgu6iUp0t+J+GWhmtnFV/TdwOMll3aprgEEnY/X1H3yuWVV1MsnNwH5gHbBn3H9ts1aNey1ZVd05bFW9ugr4TeCL3bMmgHd1L8Fe6zYBe7uZuC8C/r6qmpva3rAfBT7WvcZ2PfB3VfUvw5bUu98FPtRdDBwC3jxkMWf9tH1JUhu85ShJaoKBJklqgoEmSWqCgSZJaoKBJklqgoEmSWqCgSZJasL/AQznFcPcAIj0AAAAAElFTkSuQmCC\n",
      "text/plain": [
       "<Figure size 504x504 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    }
   ],
   "source": [
    "batch, N, C = 3, 7, 2\n",
    "\n",
    "# batch, N, z_n, z_n_1\n",
    "log_potentials = torch.rand(batch, N, C, C)\n",
    "dist = torch_struct.LinearChainCRF(log_potentials, lengths=torch.tensor([N-1, N, N+1]))\n",
    "show_chain(dist.argmax[0])\n",
    "plt.show()\n",
    "show_chain(dist.argmax[1])"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 28,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "i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+021/E3gGuHLYqvpRs452zeXdp6n/A02yBvhpYPvQtej/J8lK4DrgPoCqOjZkmIGBBrO//A7Mac/QyC/E8023Ws3VwKeHraQ/3eO43cAh4OGqaubaOn8C/BbwnaELWSAF/GOSJ7ul/VqyHngO+IvukfH2JBcPWZCBpiYkuYTZ9UJ/vapeHLqevlTViar6YWANsDFJM4+Nk7wdOFRVTw5dywL6iaq6BrgReHf3CqAVy4BrgPdX1dXAfwGDzkEw0OAgsHZOe023T0tE937po8CHqupvh65nIXSPch4DNg9dS4+uBW7q3jM9CPxkkr8atqR+VdXB7uch4GPMvuJoxQwwM+epwU5mA24wBtrsJJANSdZ3LzVvBqYGrkmvUDdx4j7gmar6o6Hr6VOSK5Jc1m1/F7MTlz4/bFX9qao7q2pNVa1j9u/do1X1CwOX1ZskF3cTlegexf0U0Mxs46r6GnAgyVXdruuBQSdj9fUPfC5ZVXU8ye3AQ8AEsGPUP22zVI1alqyq7hu2ql5dC/wi8FT3rgngd7pFsJe61cD93UzcVwF/U1XNTW1v2PcCH+uWsV0G/HVV/cOwJfXuV4EPdTcD+4HbhizmvJ+2L0lqg48cJUlNMNAkSU0w0CRJTTDQJElNMNAkSU0w0CRJTTDQJElN+F8VdBGbJgHR5wAAAABJRU5ErkJggg==\n",
      "text/plain": [
       "<Figure size 504x504 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    },
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAbQAAACSCAYAAAAttj/ZAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADh0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uMy4xLjEsIGh0dHA6Ly9tYXRwbG90bGliLm9yZy8QZhcZAAAK+UlEQVR4nO3df6xf9V3H8eeL/tqAMYpFqbSObjbETY1AU2cwpJGhZVuoiVsCiZMtLk3McJvGKGjCIn+h8XdctjSlDiYb027T62xEJizTmE0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onu+9Eng3qr61ND1jEN3K+chYOPQtfToauCG7jnTfcBPJfnzYUvqV1Xt794PAJ9m+hFHK6aAqRl3DbYzHXCDMdCmJ4GsTbKme6h5IzAxcE16mbqJE3cBT1TVHwxdT5+SXJzkwm77lUxPXPrKsFX1p6puq6pVVXUZ0//uHqyqnx+4rN4kOa+bqER3K+6ngWZmG1fVfwH7klze7boWGHQyVl+/4HPBqqpjSW4B7gcWAdtG/WqbhWrUsmRVddewVfXqauAdwKPdsyaA3+wWwV7oVgJ3dzNxzwH+oqqam9resO8DPt0tY7sY+FhV/d2wJfXul4F7uw8De4F3DVnMWT9tX5LUBm85SpKaYKBJkppgoEmSmmCgSZKaYKBJkppgoEmSmmCgSZKa8H8zrxWRPXh26wAAAABJRU5ErkJggg==\n",
      "text/plain": [
       "<Figure size 504x504 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    }
   ],
   "source": [
    "show_chain(dist.marginals[0])\n",
    "plt.show()\n",
    "show_chain(dist.marginals[1])"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 29,
   "metadata": {},
   "outputs": [],
   "source": [
    "def show_samples(samples):\n",
    "    show_chain(samples[0, 0])\n",
    "    plt.show()\n",
    "    show_chain(samples[1, 0])\n",
    "    plt.show()\n",
    "    show_chain(samples[0, 1])"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 30,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAbQAAACSCAYAAAAttj/ZAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADh0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uMy4xLjEsIGh0dHA6Ly9tYXRwbG90bGliLm9yZy8QZhcZAAAKuklEQVR4nO3df6xfd13H8eeL22664dhYF7m01Y1YiUTJNm6KZGZZHJMOyWoiJluiDiK5iWGKGqObJiPy1/QPf0UCWbpKp8gwQ/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e1kKuMEYaEuTQLYluay7qXkjMDdwT3qRuokTdwGPVdUfD91Pn5JckuTCbvn7WZq49OVhu+pPVd1WVVuq6lKW/t3dX1W/OHBbvUlyfjdRie5S3M8Azcw2rqr/BA4leW236Vpg0MlYk/z1MWtSVZ1IcguwD5gCdo/61Tbr1ajHklXVXcN21aurgF8CvtjdawL4ve4h2OvdNLCnm4n7MuBvq6q5qe0N+0Hg491jbDcAf1NV/zhsS737NeDD3YeBg8A7h2zmrJ+2L0lqg5ccJUlNMNAkSU0w0CRJTTDQJElNMNAkSU0w0CRJTTDQJElN+H8ukgcoo57FRQAAAABJRU5ErkJggg==\n",
      "text/plain": [
       "<Figure size 504x504 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    },
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAbQAAACSCAYAAAAttj/ZAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADh0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uMy4xLjEsIGh0dHA6Ly9tYXRwbG90bGliLm9yZy8QZhcZAAAKq0lEQVR4nO3df6xfd13H8eeL22664dhYF7m01Y1YiUTJNm6KZGZZHJMOyWoiJluiDiK5iWGKGqObJiPy1/QPf0UCWbpKp8gwQ/RCGuvIRtAYcHfYAdvouDYkvd20ox2DijI73v5xT5e7y7ft2Pf0e+793Ocj+eaeH5+e9/ukvffV7zmf77mpKiRJWuteNnQDkiT1wUCTJDXBQJMkNcFAkyQ1wUCTJDXBQJMkNWGsQEvyyiT3JflK9/WiU4x7Lsn+7jU3Tk1JkkbJOJ9DS/JHwLGquiPJrcBFVfW7I8Ydr6qXj9GnJEmnNW6gHQCuqaonk0wDn66q144YZ6BJks6qcQPt61V1Ybcc4OmT6yvGnQD2AyeAO6rq709xvFlgFmCKqTecxwUvubfV7kdf/62hW9AYHv/CeUO3IK1L3+Tpr1XVJaP2nTHQknwKe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\n",
      "text/plain": [
       "<Figure size 504x504 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    },
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAbQAAACSCAYAAAAttj/ZAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADh0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uMy4xLjEsIGh0dHA6Ly9tYXRwbG90bGliLm9yZy8QZhcZAAAKwklEQVR4nO3df6xfd13H8eeL225zQ9iki5S2cTNUlChu46ZKZpbFMemQrCZgsiXqIJKbGKaoMbppMiJ/Tf/wVySQpat0CgxTRK+koW7ZCBIC7A47YBsd14akt5t2tGNQUWbH2z/u6XJ3/bYd+577Pfd++nwk39zz49Pzfp98b++r33M+9zRVhSRJa91Lhm5AkqQ+GGiSpCYYaJKkJhhokqQmGGiSpCYYaJKkJowVaEl+KMk9Sb7Wfb3oFOOeTbK/e82OU1OSpFEyzu+hJflT4FhV3Z7kFuCiqvqDEeOOV9VLx+hTkqTTGjfQDgBXV9UTSTYCn6qq14wYZ6BJklbUuIH2zaq6sFsO8NTJ9WXjTgD7gRPA7VX1j6c43gwwA3DB+Xn9j7/6nBfd22r32JfOH7oFjeHHXvedoVtYMa1/b7b83kH779+3eeobVXXxqH1nDLQk9wKvHLHrj4DdSwMsyVNV9f/uoyXZVFWHk/wocB9wTVX9++nqTv/0efWFfVtO29ta9qZXXTZ0CxrDvsf3D93Cimn9e7Pl9w7af//urT0PVtX0qH3rzvSHq+qNp9qX5D+TbFxyyfHIKY5xuPt6MMmngMuB0waaJEnfj3Gn7c8CN3XLNwH/tHxAkouSnNstbwCuBB4Zs64kSc8zbqDdDlyb5GvAG7t1kkwn2dmN+QlgLslDwP0s3kMz0CRJvTrjJcfTqaqjwDUjts8B7+yWPwv81Dh1JEk6E58UIklqgoEmSWqCgSZJaoKBJklqgoEmSWqCgSZJaoKBJklqgoEm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6h+/IQG24D5qjpYVc8AdwM7Bu6pN60/lqyqnqiqL3bL3wYeBTYN21U/atHxbnV992rqX6BJNgO/COwcuhd9f5K8HLgKuBOgqp4ZMszAQIPFH36Hlqwv0MgPxLNN97Say4HPD9tJf7rLcfuBI8A9VdXMuXX+Avh94HtDN7JCCviXJA92j/ZryaXAk8DfdJeMdya5YMiGDDQ1IclLgY8Bv11V3xq6n75U1bNVdRmwGdiWpJnLxkneAhypqgeH7mUF/VxVXQFcB7yruwXQinXAFcD7q+py4L+AQecgGGhwGNiyZH1zt01rRHd/6WPAh6rqH4buZyV0l3LuB7YP3UuPrgSu7+4z3Q38fJK/G7alflXV4e7rEeDjLN7iaMUCsLDkqsEeFgNuMAba4iSQrUku7W5q3gDMDtyTXqBu4sSdwKNV9WdD99OnJBcnubBb/gEWJy59ddiu+lNVt1bV5qq6hMW/d/dV1a8M3FZvklzQTVSiuxT3C0Azs42r6j+AQ0le0226Bhh0MtYk//uYVamqTiS5GdgHTAG7Rv3XNmvVqMeSVdWdw3bVqyuBXwW+3N1rAvjD7iHYa91GYHc3E/clwN9XVXNT2xv2w8DHu8fYrgM+XFWfHLal3v0m8KHuw8BB4B1DNnPWT9uXJLXBS46SpCYYaJKkJhhokqQmGGiSpCYYaJKkJhhokqQmGGiSpCb8HzanDRQdx43EAAAAAElFTkSuQmCC\n",
      "text/plain": [
       "<Figure size 504x504 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    }
   ],
   "source": [
    "show_samples(dist.sample((10,)))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 31,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAbQAAACSCAYAAAAttj/ZAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADh0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uMy4xLjEsIGh0dHA6Ly9tYXRwbG90b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d0tgFasA64A3l9VlwP/BQw6B8FAg8PAliXrm7ttWiO6+0sfAz5UVf8wdD8robuUcz+wfeheenQlcH13n+lu4OeT/N2wLfWrqg53X48AH2fxFkcrFoCFJVcN9rAYcIMx0BYngWxNcml3U/MGYHbgnvQCdRMn7gQerao/G7qfPiW5OMmF3fIPsDhx6avDdtWfqrq1qjZX1SUs/tzdV1W/MnBbvUlyQTdRie5S3C8Azcw2rqr/AA4leU236Rpg0MlYk/zzMatSVZ1IcjOwD5gCdo360zZr1ajHklXVncN21asrgV8FvtzdawL4w+4h2GvdRmB3NxP3JcDfV1VzU9sb9sPAx7vH2K4DPlxVnxy2pd79JvCh7s3AQeAdQzZz1k/blyS1wUuOkqQmGGiSpCYYaJKkJhhokqQmGGiSpCYYaJKkJhhokqQm/B8gRgMcTDRDtwAAAABJRU5ErkJggg==\n",
      "text/plain": [
       "<Figure size 504x504 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    },
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAbQAAACSCAYAAAAttj/ZAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADh0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uMy4xLjEsIGh0dHA6Ly9tYXRwbG90bGliLm9yZy8QZhcZAAAKmUlEQVR4nO3df6xfd13H8eeLe7vphmNjXaS01c1YiUTJNm6KZGZZHJMOyWoiJlsCDiK5iWGKGqObJiPy1/QPf0UCWbpKp8gwQ/RKGuvIRpAQcHfYAdvouDYkvWXa0Y5BRZkdb/+4p8t3l2/bse/p9/R++nwk39zz49Pzfp80va+ecz733FQVkiStdS8ZugFJkvpgoEmSmmCgSZKaYKBJkppgoEmSmmCgSZKaMFGgJXl5kvuSfKX7etEJxj2bZG/3WZikpiRJ42SSn0NL8sfAkaq6I8mtwEVV9Xtjxh2tqpdO0KckSSc1aaDtA66pqieSbAA+WVWvGjPO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UhMMNElSEww0SVITDDRJUhMMNElSEww0SVIT/h/Lvv0h7CKbgwAAAABJRU5ErkJggg==\n",
      "text/plain": [
       "<Figure size 504x504 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    },
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAbQAAACSCAYAAAAttj/ZAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADh0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uMy4xLjEsIGh0dHA6Ly9tYXRwbG90bGliLm9yZy8QZhcZAAAKsElEQVR4nO3df6xfd13H8eeLttvcEDbpIqVt3Ax1ShS3cVM1M0vjmHRIVhMx2RJ1EMlNDFPQGNggGZG/pn/4KxLI0lU6RYYZolfSWEc2gsYAu8PyYxsd14akt5t0tGNQEUbH2z/u6fLd9dvbse+599z76fORfHPP55xPz+d9ctL76jnn8z1NVSFJ0lr3oqELkCSpDwaaJKkJBpokqQkGmiSpCQaaJKkJBpokqQkTBVqSH0lyb5KvdD8vOk2/Z5Ic6D4zk4wpSdI4meR7aEn+BDheVbcnuQW4qKreOabfiap68QR1SpK0pEkD7SCwo6oeT7IJ+GRVXTamn4EmSVpWkwbaN6rqwm45wJOn2ov6nQQOACeB26vqH0+zv2lgGuCC8/Oan3zlOS+4ttXu0S+cP3QJy+onXv3toUtYVi2fP8+dVrNv8eTXq+ricdvOGGhJPgG8fMymdwN7RwMsyZNV9f+eoyXZXFVHkvw4cB9wTVX911LjTv3sefXZ/VuXrG0te90rLh+6hGW1/7EDQ5ewrFo+f547rWafqHserKqpcdvWn+kPV9VrT7ctydeSbBq55Xj0NPs40v08lOSTwBXAkoEmSdIPYtJp+zPATd3yTcA/Le6Q5KIk53bLG4GrgIcnHFeSpOeYNNBuB65N8hXgtV2bJFNJdnd9fgqYTfJ54H4WnqEZaJKkXp3xluNSquoYcM2Y9bPAW7rl/wB+ZpJxJEk6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vCRfBaaqqskvVifZy8JrDXcnOQc4v6q+MVQ9XqHBdmCuqg5V1dPA3cCugWvqTeuvJauqx6vqc93yt4BHgM3DVtWPWnCia27oPk39CzTJFuBXgN1D16IfTJKXAlcDdwJU1dNDhhkYaLDwy+/wSHueRn4hnm26t9VcAXxm2Er6092OOwAcBe6tqmaOrfPnwDuA7w9dyDIp4F+TPNi92q8llwJPAH/d3TLeneSCIQsy0NSEJC9m4X2hb6+qbw5dT1+q6pmquhzYAmxP0sxt4yRvAI5W1YND17KMfrGqrgSuA97aPQJoxXrgSuD9VXUF8D/AoHMQDDQ4AmwdaW/p1mmN6J4vfRT4UFX9w9D1LIfuVs79wM6ha+nRVcD13XOmu4FfSvK3w5bUr6o60v08CnyMhUccrZgH5kfuGtzDQsANxkBbmASyLcml3UPNG4CZgWvS89RNnLgTeKSq/nToevqU5OIkF3bLP8TCxKUvD1tVf6rq1qraUlWXsPD37r6q+o2By+pNkgu6iUp0t+J+GWhmtnFV/TdwOMll3aprgEEnY/X1H3yuWVV1MsnNwH5gHbBn3H9ts1aNey1ZVd05bFW9ugr4TeCL3bMmgHd1L8Fe6zYBe7uZuC8C/r6qmpva3rAfBT7WvcZ2PfB3VfUvw5bUu98FPtRdDBwC3jxkMWf9tH1JUhu85ShJaoKBJklqgoEmSWqCgSZJaoKBJklqgoEmSWqCgSZJasL/AQznFcPcAIj0AAAAAElFTkSuQmCC\n",
      "text/plain": [
       "<Figure size 504x504 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    }
   ],
   "source": [
    "show_samples(dist.topk(10))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 32,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "torch.Size([256, 3, 7, 2, 2])\n"
     ]
    },
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAbQAAACSCAYAAAAttj/ZAAAABHNCSVQICAgIfAhkiAAAAAlw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UlUPV9U5wFpgQ5JmbhsneRmwp6puH7qWo+jvquo84BLgDd0jgFasBM4DPlZV5wK/BgZdg2CgwW5g3bz22m6flonu+dLngE9W1f8MXc/R0N3KuRXYOHQtPTofuLR7znQ98PdJ/nvYkvpVVbu7r3uAzzP3iKMVs8DsvLsG25gLuMEYaHOLQNYnObt7qHkZMDVwTXqMuoUT1wD3VNUHhq6nT0nOSHJat/145hYu/WDYqvpTVe+sqrVVdRZz/+5uqap/Gris3iQ5pVuoRHcr7h+AZlYbV9X/A7uSPKvbdREw6GKspfz1McekqjqQ5ErgRmAFsHXUr7ZZrka9lqyqrhm2ql6dD7wauLN71gTwru4l2MvdGuDabiXu44DPVlVzS9sb9hTg891rbFcCn6qqrwxbUu/eCHyyuxjYCbx2yGKO+2X7kqQ2eMtRktQEA02S1AQDTZLUBANNktQEA02S1AQDTZLUBANNktSEPwFWAPQ606eZywAAAABJRU5ErkJggg==\n",
      "text/plain": [
       "<Figure size 504x504 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    },
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAbQAAACSCAYAAAAttj/ZAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADh0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uMy4xLjEsIGh0dHA6Ly9tYXRwbG90bGliLm9yZy8QZhcZAAAKk0lEQVR4nO3df6xfdX3H8efL2wIDp6Als9JGWGz8kf0AvOlmMIQMmcUZukRNIJmimbnJIpvbsmywJZj5F9sfc1tmNE3phM2JS53zappVCBi3LCoXV0TA4l3j0lvZii2i3Q9Z8b0/7im7XL+3xX5Pv6f30+cj+eaeH5+e9/vktvfV7zmf77mpKiRJWu1eMHQDkiT1wUCTJDXBQJMkNcFAkyQ1wUCTJDXBQJMkNWGsQEvykiR3J/lG9/WCFcY9k2RP95odp6YkSaNknM+hJflj4HBV3ZbkZuCCq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DfgL4VPcY2zXA31TVPwzbUu9+HfhY92ZgH/DuIZs546ftS5La4CVHSVITDDRJUhMMNElSEww0SVITDDRJUhMMNElSEww0SVIT/g8U8fkL8geUpAAAAABJRU5ErkJggg==\n",
      "text/plain": [
       "<Figure size 504x504 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    },
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAbQAAACSCAYAAAAttj/ZAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADh0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uMy4xLjEsIGh0dHA6Ly9tYXRwbG90bGliLm9yZy8QZhcZAAAKrklEQVR4nO3df6xfd13H8eeL225zQ9iki5S2cTNUlChu46ZKZpbFMemQrCZgsiXqIJKbGKaoMbppMiJ/Tf/wVySQpat0CgxTRK+koW7ZCBIC7A47YBsd14akt5t2tGNQUWbH2z/u6XJ3/bYd+577Pb2f+3wk39zz49Pzfp/c3vvq95zP9zRVhSRJq91Lhm5AkqQ+GGiSpCYYaJKkJhhokqQmGGiSpCYYaJKkJowVaEl+KMk9Sb7Wfb3oFOOeTbK/e82OU1OSpFEyzufQkvwpcKyqbk9yC3BRVf3BiHHHq+qlY/QpSdJpjRtoB4Crq+qJJBuBT1XVa0aMM9AkSStq3ED7ZlVd2C0HeOrk+rJxJ4D9wAng9qr6x1McbwaYAbjg/Lz+x199zovuTVpJj33p/KFbWDE/9rrvDN3Cimr5e7cWfJunvlFVF4/ad8ZAS3Iv8MoRu/4I2L00wJI8VVX/7z5akk1VdTjJjwL3AddU1b+fru70T59XX9i35bS9SUN506suG7qFFbPv8f1Dt7CiWv7erQX31p4Hq2p61L51Z/rDVfXGU+1L8p9JNi655HjkFMc43H09mORTwOXAaQNNkqTvx7jT9meBm7rlm4B/Wj4gyUVJzu2WNwBXAo+MWVeSpOcZN9BuB65N8jXgjd06SaaT7OzG/A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OuBRaAB4Abq+qRQRvrSZKrgOPAXaM+I7jaJdkIbKyqLyb5QeBB4Jda+P51M4Mv6D6/uR74DPDuqvrcwK31KsnvAtPAy1p7PF6SrwPTVdXkB6uT7GbxsYY7k5wDnF9V3xyqH9+hwTZgvqoOVtUzwN3AjoF76k3rjyWrqieq6ovd8reBR4FNw3bVj1p0vFtd372a+hdoks3ALwI7h+5F358kLweuAu4EqKpnhgwzMNBg8ZffoSXrCzTyC3Gt6Z5Wcznw+WE76U93OW4/cAS4p6qaObfOXwC/D3xv6EZWSAH/kuTB7tF+LbkUeBL4m+6S8c4kFwzZkIGmJiR5KfAx4Ler6ltD99OXqnq2qi4DNgPbkjRz2TjJW4AjVfXg0L2soJ+rqiuA64B3dbcAWrEOuAJ4f1VdDvwXMOgcBAMNDgNblqxv7rZplejuL30M+FBV/cPQ/ayE7lLO/cD2oXvp0ZXA9d19pruBn0/yd8O21K+qOtx9PQJ8nMVbHK1YABaWXDXYw2LADcZAW5wEsjXJpd1NzRuA2YF70gvUTZy4E3i0qv5s6H76lOTiJBd2yz/A4sSlrw7bVX+q6taq2lxVl7D4c3dfVf3KwG31JskF3UQluktxvwA0M9u4qv4DOJTkNd2ma4BBJ2NN8r+POStV1YkkNwP7gClg16j/2ma1GvVYsqq6c9iuenUl8KvAl7t7TQB/2D0Ee7XbCOzuZuK+BPj7qmpuanvDfhj4ePcY23XAh6vqk8O21LvfBD7UvRk4CLxjyGbW/LR9SVIbvOQoSWqCgSZJaoKBJklqgoEmSWqCgSZJaoKBJklqgoEmSWrC/wHB0AMcvTlv9wAAAABJRU5ErkJggg==\n",
      "text/plain": [
       "<Figure size 504x504 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    },
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAbQAAACSCAYAAAAttj/ZAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADh0RVh0U29mdHdhc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4MOgfBQINDwOaR9U3dNq0S3fOlTwAfraq/HrqfM6G7lfMAsG3oXnp0FXBD95zpHuCnk/zFsC31q6oOdV8PA59k8RFHKxaAhZG7BrtZDLjBGGiLk0C2JLmse6h5IzA7cE96kbqJE3cCj1fVHwzdT5+SXJzkwm75+1icuPTVYbvqT1XdVlWbqupSFv/e3V9V7xy4rd4kuaCbqER3K+5ngGZmG1fVvwIHk7y223QtMOhkrJX872POSlV1PMktwF5gCtg17r+2Wa3GvZasqu4ctqteXQX8PPBI96wJ4Le7l2CvdhuBu7qZuC8B/qqqmpva3rAfBD7ZvcZ2HfCXVfXpYVvq3S8DH+0uBg4A7x6ymTU/bV+S1AZvOUqSmmCgSZKaYKBJkppgoEmSmmCgSZKaYKBJkppgoEmSmvA/OaX5C9/BKD0AAAAASUVORK5CYII=\n",
      "text/plain": [
       "<Figure size 504x504 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    },
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAbQAAACSCAYAAAAttj/ZAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADh0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uMy4xLjEsIGh0dHA6Ly9tYXRwbG90bGliLm9yZy8QZhcZAAAKrklEQVR4nO3df6xfd13H8eeL225zQ9iki5S2cTNUlChu46ZKZpbFMemQrCZisiXqIJKbGKaoMbppMiJ/Tf/wVySQpat0CgxTRK+ksW7ZCBoD7A47YBsd14akt5t2tGNQUWbH2z/u6XJ3/bYd/Z77Pfd++nwk39zz49Pzfp/09r76PefzPTdVhSRJa93Lhm5AkqQ+GGiSpCYYaJKkJhhokqQmGGiSpCYYaJKkJowVaEm+L8l9Sb7Sfb3kFOOeT7K/e82OU1OSpFEyzufQkvwRcKyq7kxyG3BJVf3uiHHHq+rlY/QpSdJpjRtoB4Brq+qpJBuBT1XV60aMM9AkSStq3ED7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kqQ2eMlRktQEA02S1AQDTZLUBANNktQEA02S1AQDTZLUBANNktSE/wNmvwMcMpkL5wAAAABJRU5ErkJggg==\n",
      "text/plain": [
       "<Figure size 504x504 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    },
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAbQAAACSCAYAAAAttj/ZAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADh0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uMy4xLjEsIGh0dHA6Ly9tYXRwbG90bGliLm9yZy8QZhcZAAAKt0lEQVR4nO3df6xfdX3H8efL2wKCU5gls7bNYLFzM5sDvOlmWAgZMoszdIkugWSKRnMTI85tWTbYEsz8i+2P/cqMhpTOsqm41LndmcYOAsYZo3LRogIWr41Jb2Ertoh2brLie3/cU3K5+7ZFvud+T++nz0fyzT0/Pj3v98m3va9+z/ncc1NVSJK02r1g6AYkSeqDgSZJaoKBJklqgoEmSWqCgSZJaoKBJklqwliBluQnk9yV5Jvd1wtOMO7pJHu71+w4NSVJGiXj/Bxakj8HjlTVrUluAi6oqj8aMe5oVb1ojD4lSTqpcQNtH3BlVT2WZD3wmap65YhxBpokaUWNG2jfrarzu+UATxxfXzbuGLAXOAbcWlX/fILjzQAzAOedm9f83CvOet69aViPfPXcoVtYUT/76h8M3cKKaf290+r2fZ74TlVdOGrfKQMtyd3Ay0bs+hNg59IAS/JEVf2/+2hJNlTVwSQ/A9wDXFVV3zpZ3elfOqe+tGfTSXvT6ev1L79k6BZW1J5H9w7dwopp/b3T6nZ37bq/qqZH7Vtzqj9cVa870b4k/5lk/ZJLjodOcIyD3df9ST4DXAqcNNAkSfpxjDttfxa4oVu+AfiX5QOSXJDk7G55HXA58NCYdSVJepZxA+1W4Ook3wRe162TZDrJ9m7MzwNzSR4A7mXxHpqBJknq1SkvOZ5MVR0GrhqxfQ54Z7f8eeA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Lsl6YH1VfTnJTwD3A7/ZwvvXzQw+r/v5zbXA54D3VtUXBm6tV0l+H5gGXtza4/GSfBuYrqomf7A6yU4WH2u4PclZwLlV9d2h+vETGmwB5qtqf1U9BdwJbBu4p960/liyqnqsqr7cLX8feBjYMGxX/ahFR7vVtd2rqf+BJtkI/Aawfehe9ONJ8hLgCuB2gKp6asgwAwMNFr/5HViyvkAj3xDPNN3Tai4FvjhsJ/3pLsftBQ4Bd1VVM+fW+SvgD4EfDd3ICing35Lc3z3aryUXA48Df9ddMt6e5LwhGzLQ1IQkLwI+AfxuVX1v6H76UlVPV9UlwEZgS5JmLhsneSNwqKruH7qXFfSrVXUZcA3w7u4WQCvWAJcBH6yqS4H/Agadg2CgwUFg05L1jd02rRLd/aVPAB+pqn8aup+V0F3KuRfYOnQvPbocuLa7z3Qn8GtJ/mHYlvpVVQe7r4eAT7J4i6MVC8DCkqsGu1gMuMEYaIuTQDYnubi7qXkdMDtwT3qOuokTtwMPV9VfDN1Pn5JcmOT8bvmFLE5c+sawXfWnqm6uqo1VdRGL/+7uqarfHrit3iQ5r5uoRHcp7teBZmYbV9V/AAeSvLLbdBUw6GSsSf76mNNSVR1LciOwB5gCdoz61Tar1ajHklXV7cN21avLgbcAX+vuNQH8cfcQ7NVuPbCzm4n7AuAfq6q5qe0N+yngk91jbNcAH62qTw/bUu/eA3yk+zCwH3j7kM2c8dP2JUlt8JKjJKkJBpokqQkGmiSpCQaaJKkJBpokqQkGmiSpCQaaJKkJ/wfA0wcUxG4uWgAAAABJRU5ErkJggg==\n",
      "text/plain": [
       "<Figure size 504x504 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    },
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAbQAAACSCAYAAAAttj/ZAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADh0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uMy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XANcB7+1uAbRiDXAF8OGquhz4L2DQOQgGGhwENi1Z39ht0yrR3V/6FPCxqvq7oftZCd2lnPuBrUP30qMrgeu7+0x3A7+Q5G+GbalfVXWw+3gI+DSLtzhasQAsLLlqsIvFgBuMgbY4CWRzkku7m5o3ALMD96QXqJs4cSfwaFX9ydD99CnJxUku7JZ/hMWJS18ftqv+VNWtVbWxqi5h8fvuvqr6tYHb6k2SC7qJSnSX4n4RaGa2cVX9B3Agyau7TdcAg07GmuSfjzkjVdWxJDcDe4ApYMeoP22zWo16LFlV3TlsV726Eng78NXuXhPAH3QPwV7t1gM7u5m4LwL+tqqam9resB8DPt09xnYN8PGq+qdhW+rdbwAf694M7AfeNWQzZ/20fUlSG7zkKElqgoEmSWqCgSZJaoKBJklqgoEmSWqCgSZJaoKBJklqwv8B+cwDHANMYTkAAAAASUVORK5CYII=\n",
      "text/plain": [
       "<Figure size 504x504 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    },
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAbQAAACSCAYAAAAttj/ZAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADh0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uMy4xLjEsIGh0dHA6Ly9tYXRwbG90bGliLm9yZy8QZhcZAAAKkElEQVR4nO3df6xfdX3H8efL2wIDpzBLZqWNsNj4I/sBeNPNsBAyZBZnqMk0gUSHZuYmi2xOYzbYEsz8i+2PuS0zmqZ0wubEpc7tzjR2EDBuMSoXV0TA4l3j0luZxRbR7oes+N4f95Rdrt/bsn5Pv6f30+cj+eaeH5+e9/vkpvfVc87nnqaqkCRptXvB0A1IktQHA02S1AQDTZLUBANNktQEA02S1AQDTZLUhLECLclPJLk7yTe6rxesMO6ZJHu6z+w4NSVJGiXj/B5akj8CDlfVbUluBi6oqt8dMe5IVb1wjD4lSTqucQNtL3BVVT2eZD3w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pd79JvDx7mJgH/DOIZs546ftS5La4C1HSVITDDRJUhMMNElSEww0SVITDDRJUhMMNElSEww0SVIT/hdxofkL137AZwAAAABJRU5ErkJggg==\n",
      "text/plain": [
       "<Figure size 504x504 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    },
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAbQAAACSCAYAAAAttj/ZAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADh0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uMy4xLjEsIGh0dHA6Ly9tYXRwbG90bGliLm9yZy8QZhcZAAAKrklEQVR4nO3df6xfd13H8eeL225zQ9iki5S2cTNUlChu46ZKZpbFMemQrCZgsiXqIJKbGKaoMbppMiJ/Tf/wVySQpat0CgxTRK+koW7ZCBIC7A47YBsd14akt5t2tGNQUWbH2z/u6XJ3/bYd+577Pfd++nwk39zz49Pzfp/c3Pvq95zP99xUFZIkrXUvGboBSZL6YKBJkppgoEmSmmCgSZKaYKBJkppgoEmSmjBWoCX5oST3JPla9/WiU4x7Nsn+7jU7Tk1JkkbJOJ9DS/KnwLGquj3JLcBFVfUHI8Ydr6qXjtGnJEmnNW6gHQCurqonkmwEPlVVrxkxzkCTJK2ocQPtm1V1Ybcc4KmT68vGnQD2AyeA26vqH09xvBlgBuCC8/P6H3/1OS+6t9XusS+dP3QLK+rHXvedoVuQRmr9Z6913+apb1TVxaP2nTHQktwLvHLErj8Cdi8NsCRPVdX/u4+WZFNVHU7yo8B9wDVV9e+nqzv90+fVF/ZtOW1va9mbXnXZ0C2sqH2P7x+6BWmk1n/2Wndv7XmwqqZH7Vt3pn9cVW881b4k/5lk45JLjkdOcYzD3deDST4FXA6cNtAkSfp+jDttfxa4qVu+Cfin5QOSXJTk3G55A3Al8MiYdSVJep5xA+124NokXwPe2K2TZDrJzm7MTwBzSR4C7mfxHpqBJknq1RkvOZ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uiQbgY1V9cUkPwg8CPxSC9+/bmbwBd3nN9cDnwHeXVWfG7i1XiX5XWAaeFlrj8dL8nVguqqa/GB1kt0sPtZwZ5JzgPOr6ptD9eM7NNgGzFfVwap6Brgb2DFwT71p/bFkVfVEVX2xW/428Ciwadiu+lGLjner67tXU/8DTbIZ+EVg59C96PuT5OXAVcCdAFX1zJBhBgYaLP7yO7RkfYFGfiGebbqn1VwOfH7YTvrTXY7bDxwB7qmqZs6t8xfA7wPfG7qRFVLAvyR5sHu0X0suBZ4E/qa7ZLwzyQVDNmSgqQlJXgp8DPjtqvrW0P30paqerarLgM3AtiTNXDZO8hbgSFU9OHQvK+jnquoK4DrgXd0tgFasA64A3l9VlwP/BQw6B8FAg8PAliXrm7ttWiO6+0sfAz5UVf8wdD8robuUcz+wfeheenQlcH13n+lu4OeT/N2wLfWrqg53X48AH2fxFkcrFoCFJVcN9rAYcIMx0BYngWxNcml3U/MGYHbgnvQCdRMn7gQerao/G7qfPiW5OMmF3fIPsDhx6avDdtWfqrq1qjZX1SUs/tzdV1W/MnBbvUlyQTdRie5S3C8Azcw2rqr/AA4leU236Rpg0MlYk/zzMatSVZ1IcjOwD5gCdo360zZr1ajHklXVncN21asrgV8FvtzdawL4w+4h2GvdRmB3NxP3JcDfV1VzU9sb9sPAx7vH2K4DPlxVnxy2pd79JvCh7s3AQeAdQzZz1k/blyS1wUuOkqQmGGiSpCYYaJKkJhhokqQmGGiSpCYYaJKkJhhokqQm/B8gRgMcTDRDtwAAAABJRU5ErkJggg==\n",
      "text/plain": [
       "<Figure size 504x504 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    },
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAbQAAACSCAYAAAAttj/ZAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADh0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uMy4xLjEsIGh0dH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LxkneBhypqoeH7mUF/VRVXQXcALy7uwXQinXAVcAHqupK4L+AQecgGGhwGNiyZH1zt01rRHd/6ePAh6vqb4fuZyV0l3IeBLYP3UuPrgZu7O4z3Qv8dJK/HralflXV4e7rEeATLN7iaMUCsLDkqsEeFgNuMAba4iSQrUku725q3gTMDtyTXqJu4sTdwONV9cdD99OnJJcmubhb/h4WJy59ediu+lNVt1fV5qq6jMW/dw9U1S8O3FZvklzUTVSiuxT3M0Azs42r6j+AQ0le1226Dhh0MtYk//uYVamqTiS5FdgHTAG7Rv3XNmvVqMeSVdXdw3bVq6uBXwK+2N1rAvi97iHYa91GYHc3E/dlwN9UVXNT2xv2/cAnusfYrgM+UlX/OGxLvfs14MPdh4GDwDuHbOacn7YvSWqDlxwlSU0w0CRJTTDQJElNMNAkSU0w0CRJTTDQJElNMNAkSU34P3paBxQ/vOAQAAAAAElFTkSuQmCC\n",
      "text/plain": [
       "<Figure size 504x504 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    }
   ],
   "source": [
    "# Enumerate \n",
    "x,_ = dist.enumerate_support()\n",
    "print(x.shape)\n",
    "for i in range(10):\n",
    "    show_chain(x[i][0])\n",
    "    plt.show()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 33,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "<matplotlib.image.AxesImage at 0x7f6e910e2fd0>"
      ]
     },
     "execution_count": 33,
     "metadata": {},
     "output_type": "execute_result"
    },
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAbwAAAChCAYAAAC8jwouAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADh0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uMy4xLjEsIGh0dHA6Ly9tYXRwbG90bGliLm9yZy8QZhcZAAAMYElEQVR4nO3dbYxc5XnG8f+FjW0RIOAQGQucQFSrqpNWCbFcoqoJ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xlsW0BZisqmer6nXgLqZ6Md303twDXJ4ki1jjQhumB8teVX0L+MFJhmwHvlxTHgHOSbJ+capbHEP0YNmrqmNV9e1u+UfAU8AFM4Yt62NhyB7M2VIKvHVVdaxbfh5YN8u4NUkOJHkkyXIIxQuA56atH+HN/7A/HVNVJ4CXgXcsSnWLY5geAHy8e/nmniQbFqe0JWXYPi13H0rynST3JXnvuItZSN3liw8Aj87Y1cyxcJIewByPhUW900qSB4HzB+y6cfpKVVWS2d4++u6qOprkPcDDSb5bVc/0XauWnH8CvlpVryX5XabOeH9tzDVp8X2bqd8BryT5GPCPwMYx17QgkpwJ/B3wh1X1w3HXMw6n6MGcj4VFPcOrqq1V9b4BX/cCL7xxSt49Hp/lOY52j88C32Qq+d/KjgLTz1Yu7LYNHJNkJfB24KVFqW5xnLIHVfVSVb3Wrd4OfHCRaltKhjlWlrWq+mFVvdIt7wdOT3LemMvqXZLTmfpF/zdV9fcDhiz7Y+FUPZjPsbCUXtKcAHZ2yzuBe2cOSHJuktXd8nnArwBPLlqFC+MxYGOSi5OsYupNKTPffTq9N1cDD1d31XaZOGUPZlyf2MbUa/qtmQA+2b1D71Lg5WmXAZqQ5Pw3rl8n2cLU77Dl9Mcf3c/3ReCpqvrsLMOW9bEwTA/mcywspZtH3wJ8Lcm1wPeBTwAk2Qz8XlVdB/wC8IUkP2Hqh7ulqt7SgVdVJ5LcANzP1LsV76iqg0luBg5U1QRT//B3Jplk6oL+jvFV3L8he/AHSbYBJ5jqwa6xFbxAknyVqXeenZfkCPBnwOkAVfV5YD9T786bBF4Ffmc8lS6cIXpwNfD7SU4A/wvsWGZ//MHUH/K/DXw3yePdtj8F3gXNHAvD9GDOx4J3WpEkNWEpvaQpSdKCMfAkSU0w8CRJTTDwJElNMPAkSU0w8CRJTTDwJElNMPAkSU34f4reKIze2yHBAAAAAElFTkSuQmCC\n",
      "text/plain": [
       "<Figure size 504x504 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    }
   ],
   "source": [
    "plt.imshow(dist.entropy.detach().unsqueeze(0))"
   ]
  }
 ],
 "metadata": {
  "celltoolbar": "Raw Cell Format",
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.7.1"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
